Category Archives: cPanel

cPanel being one of the most popular and widely used control panel in hosting
We share few tips which we come across while working day in and day out.

How to install FFmpeg & PHP-FFmpeg on cPanel

By Default ffmpeg rpms are not added in centos yum repositories

a new repository will have to be added to install ffmpeg

For centos6 64bit OS

run below commands,

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

Once done

# yum install ffmpeg ffmpeg-devel

This will install ffmpeg on server

Now once this is done

you will need to install ffmpeg-php for php to recognize ffmpeg

Below are the steps

#wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2

# tar -xvf  ffmpeg-php-0.6.0.tbz2

#cd ffmpeg-php-0.6.0

#phpize

#./configure

#make && make install

now you need to add ffmpeg.so module in php.ini

add   extension=ffmpeg.so and restart httpd

You can check for ffmpeg in phpinfo page

 

 

Note: You may get error ” error: ‘new_le’ undeclared (first use in this function)” while running make command

You need to make modification in below file ffmpeg_movie.c which is in ffmpeg-php-0.6.0

 

Changes in ffmpeg_movie.c:

  • row 311: list_entry *le; to zend_rsrc_list_entry *le;
  • row 346: list_entry new_le; to zend_rsrc_list_entry new_le;
  • row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry), to hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry),

 

 

W [FATAL] – Your RPM database appears unstable. It is not possible at the moment to install a simple RPM.

While working on a cpanel server was getting below error

“W [FATAL] – Your RPM database appears unstable. It is not possible at the moment to install a simple RPM”

root@server1 [~]# /scripts/upcp –force
—————————————————————————————————-
=> Log opened from cPanel Update (upcp) – Slave (20610) at Wed Nov 18 23:52:35 2015
[2015-11-18 23:52:35 -0500] Detected cron=0 (–force passed on command line)
[2015-11-18 23:52:35 -0500] 1% complete
[2015-11-18 23:52:35 -0500] Running Standardized hooks
[2015-11-18 23:52:35 -0500] 2% complete
[2015-11-18 23:52:35 -0500] mtime on upcp is 1444896548 (Thu Oct 15 04:09:08 2015)
—————————————————————————————————-
=> Log opened from /usr/local/cpanel/scripts/updatenow (20613) at Wed Nov 18 23:52:35 2015
[2015-11-18 23:52:35 -0500] Detected version ‘11.52.0.22’ from version file.
[2015-11-18 23:52:35 -0500] Running version ‘11.52.0.22’ of updatenow.
[2015-11-18 23:52:35 -0500] –force passed on command line. Upgrade will disregard update config settings.
[2015-11-18 23:52:35 -0500] Using mirror ‘67.222.0.10’ for host ‘httpupdate.cpanel.net’.
[2015-11-18 23:52:35 -0500] Successfully verified signature for cpanel (key types: release).
[2015-11-18 23:52:36 -0500] Target version set to ‘11.52.1.2’
[2015-11-18 23:52:36 -0500] Switching to 11.52.1.2 to determine if we can reach that version without failure.
[2015-11-18 23:52:36 -0500] ***** FATAL: Failed to download updatenow.static from server: The system cannot update the /var/cpanel/sysinfo.config file. at /usr/local/cpanel/Cpanel/GenSysInfo.pm line 101.
[2015-11-18 23:52:36 -0500] The Administrator will be notified to review this output when this script completes
=> Log closed Wed Nov 18 23:52:36 2015
[2015-11-18 23:52:36 -0500] 17% complete
=> Log closed Wed Nov 18 23:52:36 2015
—————————————————————————————————-
=> Log opened from /usr/local/cpanel/scripts/maintenance (20635) at Wed Nov 18 23:52:36 2015
[2015-11-18 23:52:36 -0500] 21% complete
[2015-11-18 23:52:36 -0500] Purging cpupdate.conf of invalid entries
[2015-11-18 23:52:36 -0500] Processing: Assuring needed symlinks in 3rdparty/bin are in place.
[2015-11-18 23:52:36 -0500] – Processing command `/usr/local/cpanel/scripts/link_3rdparty_binaries`
[2015-11-18 23:52:36 -0500] Processing: Setting clock
[2015-11-18 23:52:36 -0500] – Processing command `/usr/local/cpanel/scripts/rdate`
[2015-11-18 23:52:36 -0500] 22% complete
[2015-11-18 23:52:36 -0500] Processing: Updating cPanel signing keys.
[2015-11-18 23:52:36 -0500] – Processing command `/usr/local/cpanel/scripts/updatesigningkey`
[2015-11-18 23:52:36 -0500] 23% complete
=> Log closed Wed Nov 18 23:52:36 2015
—————————————————————————————————-
=> Log opened from cPanel Update (upcp) – Slave (20610) at Wed Nov 18 23:52:36 2015
[2015-11-18 23:52:36 -0500] E Maintenance ended, however it did not exit cleanly (256). Please check the logs for an indication of what happened
[2015-11-18 23:52:36 -0500] 95% complete
[2015-11-18 23:52:36 -0500] Running Standardized hooks
[2015-11-18 23:52:36 -0500] 100% complete
[2015-11-18 23:52:36 -0500]
[2015-11-18 23:52:36 -0500] cPanel update completed
[2015-11-18 23:52:36 -0500] A log of this update is available at /var/cpanel/updatelogs/update.1447908755.log
[2015-11-18 23:52:36 -0500] Removing upcp pidfile
[2015-11-18 23:52:36 -0500] W NOTE: A system upgrade was not possible due to the following blockers:
[2015-11-18 23:52:36 -0500] W [FATAL] – Your RPM database appears unstable. It is not possible at the moment to install a simple RPM.
=> Log closed Wed Nov 18 23:52:36 2015

 

[2015-11-18 23:52:36 -0500] W NOTE: A system upgrade was not possible due to the following blockers:
[2015-11-18 23:52:36 -0500] W [FATAL] – Your RPM database appears unstable. It is not possible at the moment to install a simple RPM.
=> Log closed Wed Nov 18 23:52:36 2015

The issue was due to corrupt RPM database

Below is the fix which is used

root@server1 [~]# mkdir /root/old_rpm_dbs/

root@server1 [~]# mv /var/lib/rpm/__db* /root/old_rpm_dbs/

root@server1 [~]# rpm –rebuilddb

root@server1 [~]# /scripts/upcp –force

Now upcp is working fine without any errors 🙂

 

 

 

 

HTTPS to HTTP redirect

Redirect your Homepage from HTTPS to HTTP

1
2
3
#Redirect your Homepage from HTTPS to HTTP
RewriteCond %{HTTPS} on
RewriteRule ^$ http://%{HTTP_HOST} [L,R]

Exim Error :File size limit exceeded

While working on one of the vps client issue we came across the  following error

“Starting exim: /bin/bash: line 1: 28406 File size limit exceeded/usr/sbin/exim -bd -q1h -oP ”

root@server [/]# /etc/init.d/exim restart
Shutting down exim: [FAILED]
Shutting down spamd: [ OK ]
Starting exim: /bin/bash: line 1: 28406 File size limit exceeded/usr/sbin/exim -bd -q1h -oP /var/spool/exim/exim-daemon.pid
[FAILED]
0 processes (antirelayd) sent signal 9

The error is due to exim_mainlog file exceeding capacity of 2GB

-rw-r—– 1 mailnull mail 2147483647 Oct 1 15:54 exim_mainlog

We truncated this exim_mainlog and restarted exim to fix this issue

root@server [/var/log]# /etc/init.d/exim restart
Shutting down exim: [FAILED]
Shutting down spamd: [ OK ]
Starting exim: [ OK ]
0 processes (antirelayd) sent signal 9
Starting spamd: [ OK ]

Got error 28 from storage engine (1030) Mysql

While working on clients server today I got the error on database while making backup of all the database using mysql dump

The error was  ” Got error 28 from storage engine (1030)”

root@hostonline [/tmp]# mysqldump –all-databases > all_databases.sql &
[1] 19341
root@hostonline [/tmp]# mysqldump: Couldn’t execute ‘SHOW TRIGGERS LIKE ‘phpbb\_posts”: Got error 28 from storage engine (1030)

After doing bit of googling I could see the error is due to lack of disk space or inodes in the hard disk or partition

I could see it was due to lack of space in  /tmp

I increased the /tmp size using below steps

root@hostonline [/tmp]# /etc/init.d/cpanel stop
Stopping tailwatchd: [30832] [2015-09-10 01:27:18 -0500] [main] Current process ‘25903’ stopped
[ OK ]
Stopping cPanel services: [ OK ]
Stopping cPanel dav services: [ OK ]
Stopping cPanel queue services: [ OK ]
Stopping cPanel brute force detector services: [ OK ]
Stopping cPanel log services:
Stopping cPanel Chat services: [FAILED]

Stopping cPanel ssl services: Waiting for (?^:^(?:stunnel$|stunnel-[0-9\.]+local)) to shutdown … not running.
[ OK ]
root@hostonline [/tmp]# /etc/init.d/mysql stop
Shutting down MySQL…… [ OK ]
root@hostonline [/tmp]# /etc/init.d/httpd stop
httpd stopped
root@hostonline [/tmp]# umount -l /tmp
root@hostonline [/tmp]# umount -l /var/tmp
root@hostonline [/tmp]#
root@hostonline [/tmp]#
root@hostonline [/tmp]# mv /usr/tmpDSK /usr/tmpDSK_back
root@hostonline [/tmp]# vi /scripts/securetmp

Now change tmpdsksize  paramater to 2048000

Save file and now run below command
root@hostonline [/tmp]# /scripts/securetmp
Would you like to secure /tmp & /var/tmp at boot time? (y/n) y
Would you like to secure /tmp & /var/tmp now? (y/n) y
Securing /tmp & /var/tmp
Calculating size on /tmp
/tmp calculated to be 4096 M based on available disk space in /usr
No separate partition for tmp!
Building /usr/tmpDSK…4194304+0 records in
4194304+0 records out
4294967296 bytes (4.3 GB) copied, 37.5703 seconds, 114 MB/s
mke2fs 1.39 (29-May-2006)
/usr/tmpDSK is not a block special device.
Proceed anyway? (y,n) Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
524288 inodes, 1048576 blocks
52428 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1073741824
32 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
tune2fs 1.39 (29-May-2006)
Creating journal inode: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Done
Setting up /tmp… Done
Setting up /var/tmp… Done
Checking fstab for entries …Done
Logrotate TMPDIR already configured
Process Complete
root@hostonline [/tmp]# /etc/init.d/cpanel start
Starting cpanel:
Waiting for cpaneld to shutdown … not running.
Waiting for webmaild to shutdown … not running.
Waiting for cpdavd-ssl to shutdown … not running.
Waiting for cpanellogd to shutdown … not running.
Waiting for entropychat to shutdown … not running.
Waiting for eximstats to shutdown … not running.
mailmanctl: no process killed
Waiting for eximstats to shutdown … not running.
[+] No running cPGreyList process found.
You may be running this update interactively from within WHM.
It is necessary we restart cpsrvd, but this will kill the session displaying update progress.
Please see the logs in /var/cpanel/updatelogs/ for further information if the update progress stops

==> SMTP Mail protection has been enabled.
All outbound SMTP connections will be redirected to localhost except:
uid is root (ports: 25,26,465,587)
uid is cpanel (ports: 25,26,465,587)
gid is mail (ports: 25,26,465,587)
gid is mailman (ports: 25,26,465,587)
The “cphulkd” service is disabled.

 

 

root@hostonline [/tmp]# /etc/init.d/httpd start [ OK ]
httpd starting

root@hostonline [/tmp]# /etc/init.d/mysql start
Starting MySQL [ OK ]

 

root@hostonline  [/home]# mysqldump –all-databases > all_databases6.sql

Mysqldump is ready now 🙂

 

 

 

libMagickWand.so.2: cannot open shared object file

While working on one cPanel server we could see below error in error_log file for one client

libMagickWand.so.2: cannot open shared object file

The error log were filled by such errors

reinstalling imagemagick  using command  /scripts/installimagemagick  didnt work as error were still persisting .

So renamed the php,ini file

mv /usr/local/lib/php.ini /usr/local/lib/php.ini-old

Now to regenerate the new php.ini file I had to use command

/scripts/phpini

A new PHP.ini was create with default entries like a newly set server.

Modified the PHP.ini to customize it  as needed

Then had to finish it by rebuilding apache and php using easyapache

/scripts/easyapache

Now all sites work fine without any error 🙂

 

 

 

 

vzquota : (error) Quota on syscall for id 248: Device or resource busy

While working on Virtualizor I could come across an error where vps was not starting

I could get below error

[root@hostonline lock]# vzctl start 248
Starting container…
Warning: configuration file for distribution cpanel-Centos64 not found, using defaults from /etc/vz/dists/default
vzquota : (error) Quota on syscall for id 248: Device or resource busy
vzquota : (error) Possible reasons:
vzquota : (error) – Container’s root is already mounted
vzquota : (error) – there are opened files inside Container’s private area
vzquota : (error) – your current working directory is inside Container’s
vzquota : (error) private area
vzquota : (error) Currently used file(s):
/vz/private/248/var/spool/exim/input/T/1ZMogT-0000tf-4T-D
vzquota on failed [3]

The issue was due to some process locking the file in container which was not allowing vps to be started or rebooted

The solution to this issue is to find the process locking up the vm on node

The command is mentioned below which is lsof  ( list of open file )

[root@hostonlinevar]# lsof 2> /dev/null | egrep ‘/vz/root/248|/vz/private/248’

bash 95741 root cwd DIR 8,1 4096 42344315 /vz/private/248/var
lsof 125649 root cwd DIR 8,1 4096 42344315 /vz/private/248/var
egrep 125650 root cwd DIR 8,1 4096 42344315 /vz/private/248/var
lsof 125652 root cwd DIR 8,1 4096 42344315 /vz/private/248/var

Kill the respective processes mentioned above

And again check if there is any process still active locking vps

[root@hostonine ~]# lsof 2> /dev/null | egrep ‘/vz/root/248|/vz/private/248’

Now VM is starting  fine  after killing the process locking the vm

[root@hostonline ~]# vzctl restart 248
Restarting container
Starting container…
Warning: configuration file for distribution cpanel not found, using defaults from /etc/vz/dists/default
Container is mounted
Adding IP address(es): 193.114.189.47 193.114.189.48
Setting CPU limit: 10
Setting CPU units: 1000
Setting CPUs: 2
Setting devices
Container start in progress…
[root@hostonine ~]#

Maildelivery Report blank cPanel/WHM

Maildevery Report sometimes does not seem to work in WHM .

The issue is due to corruption in exims stats database and tables in it

Below is the fix for same

#Login to Mysql as root

root@host [/var/lib/mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 646659
Server version: 5.5.42-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

 

#Drop database eximstats

mysql> drop database eximstats;
Query OK, 4 rows affected (0.05 sec)

 

Create new database eximstats;

mysql> create database eximstats;
Query OK, 1 row affected (0.00 sec)

mysql> quit
Bye

Now restore eximstats tables using below command

root@host [/var/lib/mysql]# mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql

#Update stats using below command

root@host [~]# /usr/local/cpanel/bin/updateeximstats
updateeximstats: database schema is up to date.

Now delivery report in WHM should show results 🙂

 

 

 

Can’t create new tempfile Mysql

While working today came across new error in Mysql

[myfuncol_student.ow_base_config] error: Can't create new tempfile: './myfuncol_student/ow_base_config.TMD

Repairing the Mysql didn’t fix this issue

mysql> repair table ow_base_config;
+———————————+——–+———-+——————————————————————–+
| Table | Op | Msg_type | Msg_text |
+———————————+——–+———-+——————————————————————–+
| myfuncol_student.ow_base_config | repair | error | Can’t create new tempfile: ‘./myfuncol_student/ow_base_config.TMD’ |
| myfuncol_student.ow_base_config | repair | status | Operation failed |
+———————————+——–+———-+——————————————————————–+

I ran below command to fix this issue

 

root@hostonl [/var/lib/mysql]# myisamchk -r -f myfuncol_student/ow_base_config.MYI
– recovering (with sort) MyISAM-table ‘myfuncol_student/ow_base_config.MYI’
Data records: 228
– Fixing index 1
– Fixing index 2

Now database is working fine

mysql> repair table ow_base_config;
+———————————+——–+———-+———-+
| Table | Op | Msg_type | Msg_text |
+———————————+——–+———-+———-+
| myfuncol_student.ow_base_config | repair | status | OK |
+———————————+——–+———-+———-+
1 row in set (0.01 sec)

 

 

Blank PHPmyadmin page in cpanel

While working with one hosting client we came across an issue where PHPmyadmin was blank

On checking logs on /usr/local/cpanel/logs/error_log we could see below error

root@hosonline  [~]# tail -n 10 /usr/local/cpanel/logs/error_log
Cpanel::Server::write_buffer(Cpanel::Server=HASH(0x4abf5d8), “HTTP/1.1 401 Access Denied\x{d}\x{a}Set-Cookie: cprelogin=no; HttpOnl”…) called at /usr/local/cpanel/Cpanel/Server.pm line 1132
Cpanel::Server::write_content_to_socket(Cpanel::Server=HASH(0x4abf5d8), IO::Socket::SSL=GLOB(0x4a9c208), 0, “HTTP/1.1 401 Access Denied\x{d}\x{a}Set-Cookie: cprelogin=no; HttpOnl”…, SCALAR(0x20f8ae8)) called at /usr/local/cpanel/Cpanel/Server.pm line 626
Cpanel::Server::badpass(Cpanel::Server=HASH(0x4abf5d8), __CPANEL_HIDDEN__, 1) called at cpsrvd.pl line 2997
cpanel::cpsrvd::badpass(__CPANEL_HIDDEN__, 1) called at cpsrvd.pl line 5278
cpanel::cpsrvd::handle_auth() called at cpsrvd.pl line 1222
cpanel::cpsrvd::handle_one_connection() called at cpsrvd.pl line 1073
cpanel::cpsrvd::script() called at cpsrvd.pl line 437
PHP Fatal error: Class ‘AuthenticationCpanel’ not found in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/common.inc.php on line 876
PHP Fatal error: Class ‘AuthenticationCpanel’ not found in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/common.inc.php on line 876
PHP Fatal error: Class ‘AuthenticationCpanel’ not found in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/common.inc.php on line 876

The issue was diagnosed to missing libraries

We resolved the issue using below command by upgrading PHPmyadmin

/usr/local/cpanel/bin/updatephpmyadmin –force

Now PHPmyadmin works like Charm 🙂