How to: Upgrade PHP and MySQL

sshYour new Centox 6.x server running Plesk 12 will need to have PHP and MySQL upgraded before going in to production.

You can do this using the Atomicorp repositories.

Check the current PHP version

php -v

Download the Atomicorp repository and keys:

wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh

Use yum to upgrade PHP and MySQL

yum upgrade php mysql

Add the most commonly used PHP modules as required

yum install php-ioncube-loader php-mcrypt php-bcmath php-zend-guard-loader db4-utils

Restart the apache/httpd service gracefully…

service httpd graceful

…and test your PHP version.

php -v

Your PHP and MySQL upgrade is now complete.

How to: Set error_reporting in PHP.INI properly

sshYour new Centos 6.x server will quickly build up logs and the php.ini log is one that can get huge. If you only want to see real errors then you need no more than the following setting in your php.ini.

Edit your current PHP.INI

nano /etc/php.ini

Replace the error_reporting setting as follows

error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR

In the even that you require a less strict log level, you can change the entry when required, debug your session then promptly change it back.

How to: Restrict use of Perl, CGI and insecure Scripting

sshWith Plesk 12 you can create a “preset” which limits the type of scripting that can be assigned by your clients. This can help with the problem where you do not allow Perl or CGI but your Reseller clients can create service plans that allow these restricted services.

To prevent this from occurring, you can create presets which will not allow your clients to override these scripting options.

The file you need to edit

nano /usr/local/psa/admin/conf/site_isolation_settings.ini

In general, your PHP will always be switched on. Your PHP should be handled by FastCGI (for performance and security). Set Perl and CGI to “off” as follows

; The section describes allowed hosting options
[hosting]
php = on
php_handler_type = fastcgi
python = off
perl = off
cgi = off;
;fastcgi = any
;miva = off
;ssi = any
;ssl = any
;shell = /usr/local/psa/bin/chrootsh
;asp = any
;php_safe_mode = off
coldfusion = off

You can easily restore the original configuration files whenever required

cp /usr/local/psa/admin/conf/site_isolation_settings.ini.default /usr/local/psa/admin/conf/site_isolation_settings.ini

As a Plesk 12 admin, you can override these settings for any subscription. This simply eliminates these scripting options from showing as options to your clients.

How to: Remove DRWEB from your Plesk dedicated server

With each new Centos based Plesk server, one of the first things you might want to do is remove the dr-web services. This is easily achieved.

yum remove drweb-base drweb-bases drweb-common drweb-daemon drweb-updater psa-drweb-configurator

Should you need to reinstall the server, you can do so in the Plesk autoinstaller or update manager in the main panel.

How to: Enable Graceful Restarts in Plesk

sshEnabling graceful restarts in Plesk 12 will reduce the apache service downtime for your clients. By default, graceful restarts are not enabled.

Let’s log into the psa database

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa

Verify if “graceful restarts” is already enabled

select * FROM misc WHERE param = "restart_apache_gracefully";

If no values are returned then let’s go ahead and make it so

INSERT INTO misc VALUES ('restart_apache_gracefully', 'true');

Now let’s reconfigure all the apache domain configurations, it can take a couple of minutes.

/usr/local/psa/admin/bin/httpdmng --reconfigure-all

You will now find your apache service outage time is drastically reduced.