Server Administration & Management

Webmail error:Warning: main(../config/config.php): failed to open stream in cPanel

I got the following error in webmail

Warning: main(../config/config.php): failed to open stream: No such file or directory in /usr/local/cpanel/base/3rdparty/squirrelmail/functions/global.php on line 18
Fatal error: main(): Failed opening required ‘../config/config.php’ (include_path=’/usr/local/cpanel/3rdparty/lib/php/:.’) in /usr/local/cpanel/base/3rdparty/squirrelmail/functions/global.php on line 18

To Fix this issue, type the following command:-

# /scripts/fixwebmail

After running /scripts/fixwebmail you may get error like this:-

chown: failed to get attributes of `/usr/local/etc/cpanel/base/webmail/data’: No such file or directory
chmod: failed to get attributes of `/usr/local/etc/cpanel/base/webmail/data’: No such file or directory

For fixing this just issue the following command:-

# cp -p /usr/local/cpanel/base/3rdparty/squirrelmail/config/config_default.php /usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php

December 23, 2012 Posted by | cPanel, Mail | , , | Leave a comment

How to view Stats without login to cPanel

You can view webalizer stats without login to your cPanel.

# cd /home/user/www

# mkdir stats

# cd stats

# ln -s /home/user/tmp/webalizer webalizer

# cd ../

# chown -R user:user stats

# cd ../

# chmod -R 0775 tmp

You can access it as http://domain/stats/

October 24, 2012 Posted by | cPanel | , | Leave a comment

How to enable Tomcat for a domain in cPanel

To enable .jsp pages for a domain

# /scripts/addservlets –domain=example.com

To disable .jsp pages for a domain

# /scripts/remservelets –domain=example.com

In some cases, these scripts won’t work. Manually check the setting for the domain.

1. Open up the Apache configuration file /usr/local/apache/conf/httpd.conf

# vim /usr/local/apache/conf/httpd.conf

2. Check if the directive given below in the virtual host entry of domain, if not add it.

Include “/usr/local/apache/conf/userdata/std/2/username/domainname/*.conf”

3. Now navigate to the directory

# cd /usr/local/apache/conf/userdata/std/2/

4. check whether the folder named username(replace username with appropriate username) exist if not, create it.

# mkdir username
# cd username
# cd example

5. If the directory “example” is not present, create it

6. Check for the file cp_jkmount.conf here, if it is not present, create it with the following contents
 <IfModule mod_jk.c>
      JkMount /*.jsp ajp13
      JkMount /servlet/* ajp13
    JkMount /servlets/* ajp13
    JkMount /*.do ajp13

7. Check the file /usr/local/jakarta/tomcat/conf/server.xml Add the entry for host http://www.example.com

# vim /usr/local/jakarta/tomcat/conf/server.xml

 <Host name=”example” appBase=”/home/username/public_html”>
      <Context path=”” reloadable=”true”
               docBase=”/home/username/public_html” debug=”1″/>
      <Context path=”/manager” debug=”0″ privileged=”true”

8. Restart the services

# /usr/local/jakarta/tomcat/bin/shutdown.sh

# /usr/local/jakarta/tomcat/bin/startup.sh

# /scripts/restartsrv_tomcat

9. Restart Apache

October 19, 2012 Posted by | cPanel, Tomcat | , , | Leave a comment

Rails applications cannot be started from cPanel

The applications show as ‘not running’ when restarted.

Make sure that APF or CSF is off. Then do the following.

# /scripts/installruby –force

# /usr/local/cpanel/bin/ror_setup

# gem install rubygems-update

# update_rubygems

Now your RoR application should start.

August 5, 2012 Posted by | cPanel | , | Leave a comment

How to ignore some files/folders from awstats reports in cPanel

Awstats will consider as a page hit any entry from the log it processes. By default some file extensions (for regular image types and css/js) are excluded from what awstats will consider as a page:

NotPageList=”css js class gif jpg jpeg png bmp ico”(this is the default). All other file types will be counted as pages. Now, if we want to completely ignore some files, or even all the content of one folder from the awstats processing we can use the SkipFiles parameter. We might want to do this to ignore some frames, hidden pages, ajax calls, etc.

The SkipFiles parameter is by default empty, and in order to use it we have to add the appropriate config in our awstats.conf file.  For example to ignore a file called somefile.php we will add “/somefile.php“:
while if we want to ignore all the pages in a folder called somefolder we will have to use a regex value like: “REGEX[^\/somefolder]“
We can add several rules separated by spaces:
SkipFiles=”/somefile.php REGEX[^\/somefolder]”

Note: this will be effective only for new updates; meaning existing data will not be affected by this (if really needed you will have to regenerate your stats to get rid of those pages in old stats).

July 26, 2012 Posted by | cPanel | , , | Leave a comment

How to Putting add-on domains on dedicated IPs in cPanel

The main domain and the add-on domains need to be on different dedicated IPs, This cannot be done directly through cPanel/WHM. If suppose your cPanel account username is “USER” and domains are:


1.) Then you have to edit the following files using vim or pico editor :

# vim /var/cpanel/userdata/USER/maindomain.tld
# vim /var/cpanel/userdata/USER/subdomain1.maindomain.tld
# vim /var/cpanel/userdata/USER/subdomain2.maindomain.tld

2) change the IP field to in each to your desired one.

3) Rebuild apache using /scripts/rebuildhttpdconf

4) Restart apache service.

5) Edit DNS zone file of each domain and point A record to the new IP.

That should be it! All your domains should work flawlessly and you should also be able to install SSL , if required.

July 21, 2012 Posted by | cPanel | , | Leave a comment

How to Pointing a sub-domain to folder outside public_html in cPanel

When you create a sub-domain, cPanel points it to the corresponding folder under public_html by default. How to point it to a folder outside the public_html, This cannot be done via cPanel/WHM but can be achieved if you have ‘root’ SSH access to the server.

1. Open the apache configuration file — /etc/httpd/conf/httpd.conf
2. Search for the virtual host entry for your sub-domain.
3. Edit the document root of your sub-domain to match the desired location.
4. Save and Exit. Restart apache.

Note: cPanel rebuilds httpd.conf from userdata files and its overwritten on every cPanel update, on every account creation, subdomain addition, or any such activity related to apache & any manual changes you make will be overwritten. To make permanent changes to a subdomain’s root folder :

1. Edit the file /var/cpanel/userdata/username/subdomain.domain.com file, change the path and save it.
2. Run /scripts/rebuildhttpdconf
3. Restart apache.

July 16, 2012 Posted by | cPanel | , | Leave a comment

How to update SpamAssassin rules in cPanel

Execute the following command from the console:-

# sa-update -D

This will update the spamassassin rules in the cPanel server.

June 28, 2012 Posted by | cPanel | , | Leave a comment

How to check php configuration on shell for cPanel server

We can check the Php versions and configurations like suphp, phpsuexec or dso on a cPanel based servers on shell using below command :

# /usr/local/cpanel/bin/rebuild_phpconf –current
Available handlers:
suphp dso cgi none
PHP4 SAPI: suphp
PHP5 SAPI: suphp
SUEXEC: enabled

June 10, 2012 Posted by | cPanel, PHP | , , | Leave a comment

How to install Python 2.6 from source code

# cd /usr/local/src

# wget http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tgz

# tar zxvf Python-2.6.5.tgz

# cd Python-2.6.5

# ./configure –prefix=/usr/python2.6 –with-threads –enable-shared

# make

# make install

Now set symlink

# ln -s /usr/python2.6/bin/python /usr/bin/python2.6

Add python lib path

# echo ‘/usr/python2.6/lib’ >> /etc/ld.so.conf.d/python2.6.conf

# ldconfig

Now check python working by running

# /usr/bin/python2.6

June 4, 2012 Posted by | Tips & Tricks, Unix/Linux | , , , , | Leave a comment

How to enable viewing HTML content in Horde

By default it is not possible for us to view the emails in HTML format using Horde webmail interface. All the html content will be displayed at the top of the page and will be requested to download. To enable the html display for horde webmail you need to modify /usr/local/cpanel/base/horde/imp/config/mime_drivers.php file.

Proceed with the following steps:-

# cd /usr/local/cpanel/base/horde/imp/config

Edit the file mime_drivers.php using your favorite editor.

# vim mime_drivers.php

Change the following line
$mime_drivers[‘imp’][‘plain’][‘inline’] = false;
$mime_drivers[‘imp’][‘plain’][‘inline’] = true;

Restart cPanel service:-

# /etc/init.d/cpanel restart

May 30, 2012 Posted by | cPanel, Mail | , , , | 1 Comment

How to check user who are using boxtrapper

Now a days boxtrapper is cause high server load in that case we need to check how many users are really using boxtrapper.You can use following simple command to heck the boxtrapper users.

# find /home/*/etc -iname .boxtrapperenable

Run above command in /home and you will found out all the users who are using boxtrapper.

May 28, 2012 Posted by | cPanel | , , | Leave a comment

How to disable strict zone checking in bind in cPanel

Recent versions of Bind distributed by RedHat and CentOS enable strict zone checking at startup time. This setting can potentially cause problems for Bind users with a large number of zone files or syntax errors in individual zone files.

As a result, users may experience an inability to restart Bind after a shutdown. cPanel has, immediately, produced and distributed an autofixer for this condition. This repair will run automatically on all systems with updates enabled. However, cPanel checks only occur at specific times and depending upon update schedules, users experiencing issues restarting Bind may benefit from manually executing the code to disable strict zone checking. If you are facing this problem,
you may safely execute the autofixer by running the following command:

# /scripts/autorepairbind_disable_checkzone

May 24, 2012 Posted by | cPanel, DNS | , , | Leave a comment

How to disable sslv2 in cPanel/WHM Services

It is easy to disable sslv2 in cPanel / WHM services ( ports 2083 , 2087, etc,. ) . To do this you need to enable stunnel from the tweak settings, After that edit the file

# vim /usr/local/cpanel/etc/stunnel/mycabundle/stunnel.conf  

and add the following line ,

options = NO_SSLv2

Now restart cPanel server.  This will fix the issue.

May 16, 2012 Posted by | cPanel | , , | Leave a comment

How to enable html display for horde

You can enable the html display for horde by using following steps but please make sure that you have been logged in as root.

# vi /usr/local/cpanel/base/horde/imp/config/mime_drivers.php

Search for the line
* HTML driver settings
$mime_drivers[‘imp’][‘html’][‘inline’] = false;

and replace it with

* HTML driver settings
$mime_drivers[‘imp’][‘html’][‘inline’] = true;
Save the changes and restart the following services.

# service cpanel restart

# /scripts/restartsrv_courier

May 16, 2012 Posted by | cPanel, Mail | , , , | Leave a comment

Disabled features still visible in cPanel

Issue :

Certain features were disabled in WHM. However, they are still visible in cPanel. So, clients can still click on it and then they see that the feature has been disabled. This sends the wrong message to the client. If the option isn’t visible, it cannot be misinterpreted.

Solution :

The features were disabled in the following way :
WHM –> Feature Manager –> Select “Default” –> Edit –> Unchecked the feature from list –> Save.

You should edit the “Disabled” list instead of the “Default” list.

If you remove the feature from “Default”, the feature will only be removed for those users who don’t explicitly have another feature list assigned to their hosting package.

When you disable the feature in the “Disabled” feature list, it is removed from the system entirely for all users regardless of the hosting package or feature list assigned to that package and hides the option in cPanel.

May 14, 2012 Posted by | cPanel | | Leave a comment

How to install & uninstall Frontpage for single domain from Shell

First you need to login into your server with the root login details and then run followings commands one by one

# /scripts/setupfp5

1. What is the servername you want to setup? http://www.unixserveradmin.com
2. Saving .htaccess file: /home/unixserv/public_html/.htaccess
3. Using Upgrade Mode
4. Saving .htaccess file: /home/unixserv/public_html/_private/.htaccess

For remove

# /scripts/unsetupfp4

1. What is the servername you want to setup? http://www.unixserveradmin.com
2. Saving .htaccess file: /home/unixserv/public_html/.htaccess
3. Using Upgrade Mode
4. Saving .htaccess file: /home/unixserv/public_html/_private/.htaccess

May 10, 2012 Posted by | cPanel | , | Leave a comment

How to fix ”DNS zone deleted by mistake“ on cPanel servers

If you delete a dns zone file for mistake in Cpanel/WHM and the account has lot of subdomains , then it can get very time consuming to fix this manually , by first adding the zone file and then adding entries for individual subdomains, below trick can fix this :

* Rename the domain name from WHM to some other name temporairily , which will create the zone file with new name for         main domain and will add zone entries for all subdomain as well.

* Now rename the domain name again back to original , and here you go , with complete zone file back in action.

May 9, 2012 Posted by | cPanel, DNS | , , | Leave a comment

Mailman error “Bug in Mailman version 2.1.11.cp3″

In latest cPanel 11.24.5if you are receiving following while selecting “modify” option from your cPanel >> Mailing Lists it will open mailing list with the following error message

Mailing list bug

You can resolve above error by using following command form your shell but make sure that you are logged in as a root user.

# chmod 02775 -R /usr/local/cpanel/3rdparty/mailman/

and if its also not resolving your issue then you can read more on it here.

If above command won’t resolve your issue, then you have to reinstall mailman by using following steps.

First take backup for current mailman directory.

[/usr/local/cpanel/3rdparty]# cp mailman mailman-back -R

Confirm disk space usage for both directory.

[/usr/local/cpanel/3rdparty]# du -sh mailman
407M mailman

[/usr/local/cpanel/3rdparty]# du -sh mailman-back
407M mailman

Then run following command

[/usr/local/cpanel/3rdparty]# /scripts/reinstallmailman


[/usr/local/cpanel/3rdparty]# /usr/local/cpanel/bin/mailman-install –force

It will resolve your issue and you won’t face any further trouble.

May 8, 2012 Posted by | cPanel | , | Leave a comment

Mailman unable to create test mailing list

cPanel issue which will not let you create a mail list.

Here is the fix. Open the file

# vim /usr/local/cpanel/3rdparty/mailman/Mailman/Defaults.py

Check for the following directives.

DEFAULT_EMAIL_HOST = ‘mail.youdomain.com’
DEFAULT_URL_HOST = ‘mail.yourdomain.com’
DEFAULT_URL_PATTERN = ‘http://%s/mailman/’

HOME_PAGE         = ‘index.html’

Insert the proper entries..

May 4, 2012 Posted by | cPanel | , | Leave a comment