How do I change the PHP versions on my VPS?

To change PHP version on your VPS, do the following steps:

   1. Login to your DirectAdmin cPanel.
   2. Click on “File manager” and navigate to “public_html” folder.
   3. Find a file named “.htaccess” and open it for editting.

To change PHP version to 5.0, add the following line:
AddHandler application/x-httpd-php5 .php .php5 .php4 .php3

To change PHP version to 5.1, add the following line:
AddHandler application/x-httpd-php51 .php .php5 .php4 .php3

To change PHP version to 5.2, add the following line:
AddHandler application/x-httpd-php52 .php .php5 .php4 .php3

Notice: This setting will make effect to all subdirectories of “public_html” folder. If you want to change PHP version for specific directory then create “.htaccess” file in that directory with your chosen PHP version.

Bookmark the permalink.

Comments are closed.