PHP 5.3 -> PHP 5.4 Transition Print

  • 1

Why The Need for Transition?

As per The PHP Group’s Unsupported Branches policy, PHP 5.3 reached End of Life (EOL) six months ago. This means that version 5.3 will no longer be supported by The PHP Group, so no new patches will be released for it, creating a security risk and causing compatibility issues for new or updated software.

As a result of this development, we are shortly transferring all our hosting account to the use the latest version of the PHP 5.4 branch. This is necessary to continue to provide a secure environment to all our clients in the hosting environment, as well as to prevent compatibility issues with new and updated PHP software.

As per The PHP Group’s Supported Versions policy, PHP 5.4 will continue to receive security support until September 2015. As part of an initiative to continue to provide the latest up-to-date versions and secure hosting environments, we are taking strong strides and efforts to continue to keep the default version of PHP on our servers more closely aligned to the support schedule of The PHP Group.

The Plan

Several key issues make transitioning to newer versions of PHP difficult for our clients.

The PHP Group covers some purely scripting concerns in this migration documentation. Of these concerns, we find the most notable and expect the greatest amount of problems with the following:

ProblemExplanation
register_globals The removal of this element breaks OS Commerce and some older scripts
magic_quotes The removal of this element breaks very old scripts

On our Shared Servers specifically, we have the following concerns:

 

To make this transition smooth and simple for everyone, we are adding a configuration directive at /home/myuser/.htaccess (replace myuser with your cPanel username) which will keep the account running on PHP 5.3. If this is already a file there, this configuration is prepended, so it will be overwritten by any configuration you already have in place. This means that local custom php.ini files, etc will still be used. There may be a small number of users that have configurations which are incompatible with this transition, but the legacy handler is still just as accessible (see the bottom of this post).

This will allow for a soft-launch of PHP 5.4, where the server itself will be updated to support PHP 5.4, while your account continues to actively run PHP 5.3. Therefore, you can transition their PHP scripts and configurations to be compatible with the new version, allowing you to prevent having your site down due to version incompatibility errors if your site is not quite ready for the new PHP 5.4 environment.

All accounts will need to be compatible with PHP 5.4 (and the rest of the 2015 Standard LAMP stack that includes Apache 2.4) by a future date, which we will communicate with you via email.

Moving your Account to PHP 5.4

If you have addressed the above concerns and feel you are ready to configure your account to use PHP 5.4, you can accomplish this by simply commenting (place a # character at the beginning of the directive lines) the configuration directives from /home/myuser/.htaccess(replace myuser with your cPanel username) in your home directory:

# Custom Legacy PHP 5.3 handler placed by host 
AddType application/x-httpd-php53 .php5 .php4 .php .php3 .php2 .phtml 
suPHP_ConfigPath /usr/local/lib/php53.ini 
# End Custom Legacy PHP 5.3 handler placed by host

However, if you find you are not ready for PHP 5.4, by simply uncommenting the configuration directives, your account will revert back to PHP 5.3.

Please make all haste and effort to prepare and configure your accounts to be compatible with PHP 5.4 as soon as possible. If you wait too long, you may end up with a large problem due to incompatibility between versions that you may not have time to fix before they result in your site failing to display due to compatibility errors.

Custom AddType

If you are using a custom AddType (ie, for loading .html with PHP), you should be aware of the following:

The relevant lines from the updated suPHP conf and php.conf look like this:

# suPHP Conf
application/x-httpd-php5="php:/usr/bin/php"
application/x-httpd-php53="php:/usr/bin/php53"

# php.conf
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
<Directory />
    suPHP_AddHandler application/x-httpd-php5
suPHP_AddHandler application/x-httpd-php53
</Directory>

This means that the default PHP5 handler application/x-httpd-php5 will now load PHP 5.4 rather than the legacy PHP 5.3. If you need the old PHP 5.3 handler, you may now useapplication/x-httpd-php53

Crontab

We have also updated the Crontab to ensure any references to the system PHP would use the new legacy handler before we recompile.

Before:

0 * * * php /home/myuser/public_html/beta/cron.php

After:

0 * * * php53 -c /usr/local/lib/php53.ini /home/myuser/public_html/beta/cron.php

You will need to update the cron as well when you are ready to upgrade. Just move it back to using the new 5.4 “php” without referencing the old global ini


Was this answer helpful?

« Back

Powered by WHMCompleteSolution