How To Fix Common Issues after A PHP Upgrade

How To Fix Common Issues after A PHP Upgrade

Do you find such errors while using PHP and do you wish solve these errors? Then here is the solution:Upgrading your PHP version is necessary to get more features and functionality. However, it can also pose some problems on stability, security, and features. Your website may encounter some problems after upgrading to a higher version. In this document, we will provide you with some guidelines on fixing common issues after an upgrade.
PHP Upgrade - Common Issues
PHP Upgrade – Common Issues

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:

  1. For PHP 5.3, copy the /usr/local/lib/php.ini. This is the default php.ini file.
  2. For version 5.2.17, copy the php.ini file located at /opt/php/php-5.2.17/lib/php.ini.
  3. Other versions can be found in the /opt/php directory

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:
SuPHP_ConfigPath /home/USERNAME/public_html/

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.

Wrap Up

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.

Leave a Reply

Your email address will not be published. Required fields are marked *