Namecheap shared hosting servers are usually configured with PHP version 5.3 as native PHP. Some newer scripts require PHP version to be at least 5.4 or later. With PHP version 5.3 or lower, these scripts won’t work. Simply changing PHP version from Namecheap cPanel sometimes cause internal server error, making your site to go down. In such case, you will need to make additional changes in PHP file.
If you want to change PHP version on Namecheap shared servers and avoid errors afterwards, keep reading,
How to Change PHP version on Namecheap Shared Servers
Step 1: Selecting PHP version in cPanel with the help of PHP Selector
Log-in to your cPanel with administrative credentials. Your cPanel URL will be usually yourdomain.com/cpanel.
Find Software and Services on default cPanel page and click Select PHP Version underneath.
Once in PHP selector window, you can see which PHP version is currently set on your shared server. For example, PHP version 5.3.
Now click the drop-down button and select the version you wish to set and click Set as current button.
Note: Namecheap currently supports PHP versions from 5.2 to 5.6 on their shared servers. Click here to read more. (Go to Tech Specs -> Server Features)
Step 2: Downloading and uploading new php.ini file.
After selecting a new PHP version, you will need to make a few changes in your php.ini file in order to solve issues caused by changed PHP version. Download a new php.ini_txt file from the following link.Version 5.4 – 5.6 Rename the file from php.ini_txt to php.ini. Now we will upload the new PHP.ini file on server.
On cPanel main screen, click File Manager. File Manager link can be found under Files. Select Web Root and make sure Show Hidden Files (dotfiles) option is enabled. Click Go.
Once under file manager, find current php.ini file and rename it to something like php.ini-OLD. This is for backup purpose. You can also download this file on your computer.
Now upload the new php.ini file which you downloaded. Click upload button on top and browse to the location of file you just downloaded. Select the file and upload it. After the file has been uploaded, refresh the public_html folder and you will see php.ini.txt file. Change the file name from php.ini.txt to php.ini.
Step 3: Making new PHP setting global using SuPHP.
SuPHP (Single user PHP) is a php handler, which executes PHP scripts with the permissions of their owners. Using SuPHP, you can make settings from the chosen php.ini file global for the entire account.
If your php.ini is located in public_html folder, you will have to edit .htaccess file in order to make PHP settings global for your hosting account.
So go back to file manager and under public_html folder, you should find .htaccess file. This is a hidden file so you will only see it if you chose the Show Hidden Files (dotfiles) option while opening File Manager from main cPanel screen.
If you don’t see .htaccess file even after enabling show hidden files option, you will need to create one. Click New File on top left corner of the screen and create a new file named .htaccess under public_html folder.
Now right click on .htaccess file and click edit. Leave the options default and click Edit again. This will open a file editor in a new window.
Now add the following piece of code to the .htaccess file. This option tells mod_suphp which path to pass on to the PHP-interpreter and which folder to execute php.ini from.View Code
In above code, replace USER with your cPanel username.
Now save .htaccess file and close the window. That’s it. You have successfully changed the PHP version on Namecheap shared server. Facing issues? Feel free to add a comment.
You were reading How to Change PHP version on Namecheap Shared Servers on techstuffer.com. If you found this tutorial useful, please share with others.
Support Me: If this article/tutorial helped you today, please consider supporting me and help me run frunction.com