Category Archives: cPanel

Search for Cpanel issues and fixes

log bytes error: apache can not start

Issue :-

When I restart Apache, it throws the following error.

/usr/local/apache/libexec/mod_log_bytes.so into server: /usr/local/apache/libexec/mod_log_bytes.so: cannot open shared object file: No such file or directory
Oct 13 07:47:48 web rc: Starting httpd: failed

Invalid command ‘BytesLog’, perhaps mis-spelled or defined by a module not included in the server configuration

Reason
The problem with this kind of symptom is most likely due to the cause that the mod_belimited.so, mod_log_bytes.so, or mod_bandwidth.so are deleted or corrupted. These 3 files are unique to cPanel-powered web hosting service and are used to control, monitor or restrict the bandwidth usage limit.

Fix
The resolution and solution to the error is to recompile and redeploy the missing or unable to find shared library modules. You can easily compile these cPanel modules for Apache by using the following commands:

cd /usr/local/cpanel/apache
/usr/local/apache/bin/apxs -iac mod_log_bytes.c
/usr/local/apache/bin/apxs -iac mod_bwlimited.c
/usr/local/apache/bin/apxs -iac mod_bandwidth.c

After compilation, the .so files will automatically copied to libexec directory for Apache HTTPD web server.

Advertisements

postgres ERROR: role “username” does not exist

Issue 1

When I am trying to create Postgre DB using Cpanel, I get the following error:

Error from postgres wrapper: PostgreSQL has not been configured by the administrator. Unable to locate pgpass file.

Fix 1
You need to install a Postgres authentication configuration file that uses md5 passwords which works with cPanel. You can do this through WHM.

Login to WHM >> SQL Services >> Postgres Config >> Click on “Install Config”.

Issue 2
Okie  now I can create databases with new accounts. But already created accounts have  issues. It says  database created but it actually not creates and shows the following error in cPanel logs

tail -f /usr/local/cpanel/logs/error_log

ERROR:  role “username” does not exist
ERROR:  role “username” does not exist

Fix 2

Login to the server as “root” and execute the following command.

cd /var/cpanel/users && for x in *; do su -c “createuser -S -D -R $x” postgres; done

Proftpd error: fatal: Socket operation on non-socket

Error

root@hostname [~]# /etc/init.d/proftpd restart
Stopping proftpd: [FAILED]
Starting proftpd: hostname.domainname.com – fatal: Socket operation on non-socket
[FAILED]

Reason


The ProFtpd was configured to run in “inetd” mode. In “inetd” mode, ProFTPD expects that it will be run from the inetd super-server, which implies that stdin/stdout will be sockets instead of terminals. As a result, socket operations will fail.

root@hostname [~]# grep ServerType /etc/proftpd.conf

ServerType                      inetd

root@hostname [~]#

Fix

Edit the proftpd configuration and  change the ServerType to “standalone” mode and restarted ProFtpd.


root@hostname [~]# grep ServerType /etc/proftpd.conf
ServerType                      standalone
#ServerType                      inetd
root@hostname [~]#    /etc/init.d/proftpd restart
Stopping proftpd:                                          [FAILED]
Starting proftpd:                                          [  OK  ]

For more details : http://www.proftpd.org/docs/faq/linked/faq-ch4.html

Certificate for exim will expire in 30 days

ISSUE :-

I received 4 emails with following subjects.


Certificate for courier-imapd on hostname.domainname will expire in less then 30 days
Certificate for cpanel on hostname.domainname will expire in less then 30 days
Certificate for exim on hostname.domainname will expire in less then 30 days
Certificate for courier-pop3d on hostname.domainname will expire in less then 30 days

The contents in all of the emails is

Certificate for courier-imapd on hostname.domainname will expire in less then 30 days. You should install a new certifcate as soon as possible. You can install a new certificate in WHM under “Manager Service SSL Certificates”, or by clicking this link: https://hostname.domainname:2087/scripts2/manageservicecrts

Fix :-

Exim or the mail server uses self signed certificates for its services and is valid for one year. You need to renew the certificate in every year. You can renew the certificates from WHM as follows.

WHM login >> Main >> Service Configuration >> Manage Service SSL Certificates >> Reset Certificate


How to Disable/Enable open_basedir protection in cPanel servers?

You can easily Disable/Enable open_basedir protection in cPanel servers as follows.

Login to the WHM panel >> Main >> Security >> Security Center >> open_basedir protection

Here you can Disable/Enable the protection for particular domain or server wide.

How to install GD/Curl in cPanel server?

In cPanel servers, the safest way to install PHP modules is to use the cPanel script for Apache-PHP compilation. You can do this as follows.

WHM login >> Main >> Software >> Apache Update
Or from the console execute /scripts/easyapache


Go through each step as follows.

1. Click “start customizing based on profile”
2. Select Apache Version – Click Next to proceed with the current version.
3. Select PHP Major Version – Click Next to proceed with the current version.
4. Select PHP Minor version – Click Next to proceed with the current version.
5. Short option list – Click Exhaustive Options List to view full options.
6 Exhaustive Options List – From here you can select the PHP modules you needed

In this case you need to select ‘GD’ and/or ‘CURL’
7. Click Save & Build to start apache-php compilation.

Once the compilation over you can verify the installed modules using the following command.

[root@servername ~]# php -m

#2002 – The server is not responding (or local MySQL server’s socket is not correctly configured).


Issue : –

While accessing PhpMyAdmin getting the following error.


ERROR
#2002 – The server is not responding (or local MySQL server’s socket is not correctly configured).

Reason :-

The  mysql socket file is missing from the /tmp directory

Fix :-

1. Create a symbolic link from the original mysql socket file to /tmp

[root@test ~]# ln -s /var/lib/mysql/mysql.sock /tmp

OR

2. Restart MySQL service from WHM

WHM Login >> Main >> Restart Services >>SQL Server (MySQL)

OR

3.  Edit the PhpMyAdmin configuration file to use the original MySQL socket file.

vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

Make sure, the correct mysql socket file is mentioned there.
~~~~~~~~~~~~~~~~
$cfg[‘Servers’][$i][‘socket’] = ‘/var/lib/mysql/mysql.sock’;
$cfg[‘Servers’][$i][‘connect_type’] = ‘socket’;
~~~~~~~~~~~~~~~~