Change your php version Print

  • 15

How do I change the PHP version of my server from say php6 to php7.

METHOD 1:

You are required to create a php.ini file and place it on the root directory of your application with the directive of the new php version you desire e.g.

AddHandler application/x-httpd-php70 .php .php5 .php4 .php3

METHOD 2:

The most recommended method is to modify the .htaccess file on the root of your server (public_html) with the directive of the new php. This directive will be applied globally, and you can override it by by placing custom .htaccess files in other folders if you have multiple applications with different php versions. e.g.

#PHP 7.1
AddHandler application/x-httpd-php71 .php .php5 .php4 .php3

or

#PHP 7.1
AddHandler application/x-httpd-php71 .php

#PHP7
AddHandler application/x-httpd-php7 .php

or
#PHP7
AddHandler application/x-httpd-php70 .php

#PHP 5.6
AddHandler application/x-httpd-php56 .php

METHOD3:

Finally, you can change the directive from inside Cpanel, by clicking the "PHP configuration" icon, and chose the version you want. This step will add the directive on the .htaccess on the root directory, and it will be applied globally on your website. I hope this helps. If it does not meet your specifications, write a support ticket and we shall be happy to assist further.


Was this answer helpful?

« Back

Powered by WHMCompleteSolution