How to change default PHP version in Plesk

How to change default PHP version in plesk

In this article, we will see how we can change the default PHP version in plesk. The latest plesk versions come with all the php versions installed (we have the option to install all the php versions). So, there is no need to install a separate PHP in the server for setting the default PHP to the latest version.

So how does it work? Users can create “symlink” and some additional commands to bring the default handler to the required version.

Let’s see a realworld scenario:

Here is the environment in which the command worked.

Plesk Version : 17.5.3 CentOS 7

List the php handlers

/usr/local/psa/admin/bin/php_handlers_control --list

Verify the default php version.

php -v

Check the PHP version 5.6

/opt/plesk/php/5.6/bin/php -v

Find the default php binary

which php

Backup the php, php-cgi and php-fpm binaries.

mv /usr/bin/php /usr/bin/php.backup
mv /usr/bin/php-cgi /usr/bin/php-cgi.backup
mv /sbin/php-fpm /sbin/php-fpm.backup

Create symlink from php 5.6 binaries

ln -s /opt/plesk/php/5.6/bin/php /usr/bin/php
ln -s /opt/plesk/php/5.6/bin/php-cgi /usr/bin/php-cgi
ln -s /opt/plesk/php/5.6/sbin/php-fpm /sbin/php-fpm

You can set symlink from any other php version installed in the server. Following are the php bnaries for other versions, find the same for php-cgi and php-fpm too.


Once the symlink is created, the php version will show the new version we set. You can check it using the following command.

php -v

Next option is to update the plesk database with the changed versions. The reread option will update plesk database with the new versions.

/usr/local/psa/admin/bin/php_handlers_control --reread

After that reconfigure all the domains or the domains using the default php versions. And proceed with a service restart.

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all
service httpd restart

Please ensure that you make these changes with the help of a qualified technician.

You can also talk to our server helpdesk support experts to help you implement these changes for your server. Please get it touch server helpdesk support.

Nixtree offers a wide spectrum of server management services such as, cPanel Server Management, Plesk Server Management, Free Panel Server Management, Directadmin Server management and more.

Subscribe to our services to gain quality support leveraging our experience and technical expertise!

Facebook Comments