php configuration using rebuild_phpconf in cpanel

Filed Under (cPanel/WHM, Linux) by WebScHoLaR on 24-02-2011

Tagged Under : , ,

cPanel allows php to be configured as DSO, suPHP and FastCGI. PHP can be reconfigured using /usr/local/cpanel/bin/rebuild_phpconf script. This also allows to set the default PHP version (4 or 5) and enable/disable SuExec. Script has multiple command line parameters that can be passed to it. Script itself shows the available parameters:

[root@Server ~]# /usr/local/cpanel/bin/rebuild_phpconf
Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess] [--current|--available]
–dryrun : Only display the changes that would be made
–no-restart : Don’t restart Apache after updating the php.conf link
–no-htaccess : Don’t update user configurable PHP mime mapping.
–current : Show current settings
–available : Show available handlers and PHP SAPIs
: Version of PHP to set as default handler for .php files

: Type of Apache module to use in serving PHP requests
: enabled, disabled, 1 or 0

Read the rest of this entry »

custom virtualhost settings in cPanel

Filed Under (cPanel/WHM, Linux) by WebScHoLaR on 24-02-2011

Tagged Under : ,

cPanel allows custom modification to any website Virtual Host section. httpd.conf in cPanel server is no longer used as a data store and it is rebuilt based on information stored at /var/cpanel/userdata mostly. A directory is created for each user at /var/cpanel/userdata that contains information about the websites. Virtual host section is added for each website that is setup in cPanel. Any custom settings can be added to Virtual Host using include file that should be created at following path:

Read the rest of this entry »

Repair rpm database on *nix

Filed Under (cPanel/WHM, DirectAdmin, InterWorx, Linux, Plesk) by WebScHoLaR on 24-02-2011

Tagged Under : , ,

1. Check for processes holding the rpm database open (usually in MUTEX/FUTEX states):

lsof | grep /var/lib/rpm

If it finds any, kill -9 them all.

2. Delete any temporary DB files:

rm -fv /var/lib/rpm/__*

3. Rebuild your RPM database:

rpm –rebuilddb -v -v

If you still have problems, a reboot is probably quickest, then repeat steps 2 and 3 above.

Pure-Ftp File display limit

Filed Under (cPanel/WHM, Linux) by WebScHoLaR on 16-02-2011

Tagged Under : , , ,

pure-ftp is a popular FTP Server. By default has a display limit of 2000 files, this prevents the server from showing more then 2000 files when you browse a directory with a FTP client. If there will be more than 2000 files, then the FTP client will only show the first 2000 files and rest of the files will not appear. You will most likely see following error:

226-Options: -l
226 Output truncated to 2000 matches

In pure-ftp, this limit can be raised. LimitRecursion is the parameter that defines this limit. It is usually specified inside pure-ftpd.conf. In order to raise the limit the parameter can be set as:

LimitRecursion 5000 15

The first argument is the maximum number of files to be displayed. The second one is the max subdirectories depth. FTP server needs to be restarted after this change so that the new settings can be applied:

/etc/init.d/pure-ftpd restart

Backup mysql stored procedures

Filed Under (cPanel/WHM, Linux, MySQL, Windows) by WebScHoLaR on 29-01-2011

Tagged Under : , ,

mysqldump is the utility to backup mysql databases. By default it generate backup for the complete database. In case only backup of stored procedures is required, this can be done as:

mysqldump –routines –no-create-info –no-data –no-create-db –skip-opt database_name > /path/to/database_name.sql

Bulk Update DNS zone files serial

Filed Under (cPanel/WHM, DirectAdmin, Linux) by WebScHoLaR on 11-12-2010

Tagged Under : , , , ,

DNS zone files in Bind are refreshed by increasing the serial number that is in the format yyyymmddXX (e.g 2010121101 i.e 11th December, 2010 and serial number is 01). In case all DNS zone files on the server need to be refreshed by incrementing serial number, this can be done as:

for i in `ls /var/named/*.db` ; do cat $i | sed ‘s/[0-9]\{10\}/2010121101/g’ > $i.new; mv -f $i.new $i; chown named.named $i ;done

This will set serial for all DNS zone files to 2010121101. Make sure to reload BIND after wards as:

[root@System ~]# rndc reload
server reload successful

Repair innodb corruption on cPanel mysql Server

Filed Under (cPanel/WHM, Linux, MySQL) by WebScHoLaR on 07-11-2010

Tagged Under : , , ,

1. Stop mysqld.
2. Backup /var/lib/mysql/ib*
3. Add the following line into /etc/my.cnf

innodb_force_recovery = 4

4. Restart mysqld.
5. Dump all tables:# mysqldump -A > dump.sql
6. Drop all databases which need recovery.
7. Stop mysqld.
8. Remove /var/lib/mysql/ib*
9. Comment out innodb_force_recovery in /etc/my.cnf
10. Restart mysqld. Look at mysql error log. By default it should be /var/lib/mysql/server/hostname.com.err to see how it creates new ib* files.
11. Restore databases from the dump:mysql < dump.sql

You can also run /scripts/mysqlup –force after step 8. as this will recreate the ibdata files. This is also unsupported and caution should be taken to not lose any vital customer data in the databases.

Configure: error: cannot run C compiled programs

Filed Under (cPanel/WHM, Linux) by WebScHoLaR on 07-11-2010

Tagged Under : , , , ,

/tmp drive is recommended to be mounted as noexec to prevent any exploitable scripts execution. If during installation, make fails with the error:

checking whether the C compiler works… configure: error: cannot run C compiled programs.
ERROR: `/root/tmp/xxxx/configure failed

It means that executable files cannot be created in /tmp. Mount options for /tmp can be checked as:
Read the rest of this entry »

Wrong Perl Version Display in cPanel

Filed Under (cPanel/WHM) by WebScHoLaR on 10-10-2010

Tagged Under : ,

cPanel displays the perl version installed on the server. If perl is upgraded and cPanel still shows the same old version, remove the perl version file from cPanel datastore inside user home:

# find /home/*/.cpanel | grep _usr_bin_perl_-v | awk ‘{system (“rm ” $1)}’

When the user loads cPanel again it will refresh the perl version with the correct version from the system.

Change mailserver IP address on cPanel

Filed Under (cPanel/WHM) by WebScHoLaR on 10-10-2010

Tagged Under : , , ,

By default mailserver uses the main ethx IP as outgoing IP to send emails. If its blacklisted then instead of changing the main ethx IP, mailserver IP can be changed. To change the IP for all domains on the server:

Pre-requisite: If you are changing the mailserver ip, make sure that reverse DNS is setup for that IP or all emails will not be delivered properly.

1) In WHM , click on Exim Configuration Editor Then click the check box beside – Read the rest of this entry »

Proudly Hosted by eServicesProvider