How To Fix Common Issues after A PHP Upgrade
Fixing upgrade related problems involve the following processes:
- Reverting to the old version
- Copying an updated php.ini version
- Correcting “500 Internal server Error”
- Using Zend Optimizer and Zend Guard
- Using cron with PHP version 5.2.17
In this blog, we will cover the first three topics. The next two processes will be covered on the next blog.
So let us begin this tutorial with reverting to an old version.
Reverting To An Old Version
If you encounter any problem after having your version upgraded, you can always go back to the previous version. You can do this using the PHP version tool in cPanel.
After upgrading your website to a higher PHP version, you may encounter some depreciation errors. This is because some functions or features used by your site have been removed. You have the option to either edit your website’s code to make it compliant to the new version or go back to the previous version.
Copying An Updated Php.ini Version
If you are using a custom php.ini file, ensure that you are using the correct file for your version:
- For PHP 5.3, copy the
/usr/local/lib/php.ini. This is the default php.ini file.
- For version 5.2.17, copy the php.ini file located at
- Other versions can be found in the
To copy the updated php.ini file to your public_html directory, log in to your SSH account and then use the cp command. To apply it to all subdirectories, add the following to your .htaccess file.
Replace USERNAME with your own account username:
If you are using custom configurations, you must reconfigure them after copying the updated php,ini file.
Correcting “500 Internal Server Error” After Upgrade
If you get a “500 Internal Server Error” after upgrading to a higher PHP version, check the .htaccess file in your public_html directory. At the end of the file, you could see text similar to the following:
# Start A2 Switcher Block
# Do not remove or modify this block! Added by PHP Switcher from cPanel to use an alternate PHP version. Contact Support for details.
AddHandler application/x-httpd-php-5.4.13 .php
# End A2 Switcher Block
Adding AddHandler value will help determine the PHP version for your site. Check if the correct version is indicated and the line formatting is correct. Depending on the previous configuration of your .htaccess file, you may find that the lines of text have been merged which could pose some problems.
New PHP versions allow more functionality for your website. However, they are also prone to bugs that need to be fixed. You can hire dedicated PHP developers to fix the problem for you.
For more information on how to fix upgrade issues, Share your issue in below comment section.