Converting PHP 4.3.9 to 5.3.X

Any tips? It’s been awhile since I’ve done the 4.x to 5.x conversion, and I’ve never tried moving code between two engines this far apart before. No, starting over isn’t an option.

What exactly isn’t working? Most PHP4 code will run without a problem in PHP5. In PHP 5.2 most issues were resolved using ini_set(‘zend.ze1_compatibility_mode’, true); however, this was removed in 5.3. I’d say try it, you might be surprised that 99% of things work (Depending how it was coded). Does the PHP4 code use objects? There’s a couple of minor gotchas with comparisons that you might hit if so.

Try to migrate the code from the mysql_* extension over to PDO. Depending on how your code is set up you might be able to migrate an area at a time or you might have to migrate it all at once. Is the server that the migrated code is going to run on running php 5.3.x? Unless the server is running code that won’t run on any PHP version newer then 5.3.x consider migrating the server over to PHP 5.4.x or preferably 5.5.x (the latest version). How much code is there to be migrated over?

5.5 is definitely not preferred, yet! It’s still in beta. Running a beta version of PHP on a production web server is definitely not advisable.

Once I resolved the PECL paths and a shared lib call it runs the homepage like a clock. I’m just looking for a list of common things that can go wrong while I sort through the mess. To be honest, the Apache config has been more a beast than the PHP so far.

Unlike the vast majority of old PHP projects, this particular one was built on postgres, not mysql. Availability of PDO though is one of the primary reasons for the conversion.