How to change your PHP version using a php.ini file – This is a legacy article and is for informational use only. You can modify your PHP version from cPanel automatically.
We have already written about how you can use your php.ini file to redirect website visitors to your SSL certificate and how to use a php.ini file to increase the limits PHP can use when running applications but what about changing what version of PHP your website uses?.
Our reseller accounts can use up to ten different PHP versions at the same time. You could use PHP version 5.5 in a directory called /blog and then also use PHP 7.2 in another folder called /customers but how do you achieve this?
Firstly we offer the following versions of PHP
- PHP 7.x
PHP 5.2.17 – suhosin
PHP 5.6.27 – Default
All accounts currently use PHP 5.6.27 by default in the near future this will change to PHP 7. So to use a different PHP version first in the folder where your application is, create a new text file and call it php.ini
For example, if you had WordPress installed at www.youdomain.com/blog you would create a php.ini file in the folder /public_html/blog
Inside the file add the following line
AddHandler application/x-httpd-php56 .php
The above example would set the blog folder and everything inside it to use PHP 5.6
To use PHP version 5.2 the line would be modified to look like this
AddHandler application/x-httpd-php52 .php
Or to use PHP version 4.4 you would enter
AddHandler application/x-httpd-php54 .php
What if you just want to set the whole account to use a different PHP version? You can simply upload a php.ini file to the public_html folder, define your PHP version and the whole account will use the version you specify. You can normally achieve this by logging into cPanel and clicking “PHP Version Manager” but due to template issues with the new paper_lantern theme, the GUI way is currently not working as it should. The developer is working to resolve this issue as fast as possible.
How was this article? -How to change your php version using a php.ini file
You might also like
More from Reseller Web Hosting
PHP Updates - PHP 5.6 & PHP 7.0 Is Being Retired From Our Network In six months time (December 2018) PHP …
New Backup System For Web Hosting and Reseller Web Hosting Customers We're currently trialing a new backup system for all Web …
How to create a blog network in multiple locations using a First2Host cheap VPS SEO hosting is one of the great …