Question

I have a site that is written completely in PHP4 - the supported version on my hosting at the time. After tons of time on this language, I've come to see that PHP5 has a lot of stuff that I think would be useful to me.

Two questions:

  1. Would switching my hosting to PHP5 cause any serious damage to existing PHP4 scripting?

  2. Is PHP5 considered the standard, or are most people still using PHP4?

See also

Difference between php 4 and php 5?

Was it helpful?

Solution

  1. Depends on the quantity/quality of the PHP4 code involved. Some code is compatible, some is not-- there's a good chance you will need to make at least one source modification, so if you're not a developer, this is not a good idea.

  2. PHP5 is (should be) by now the standard, yes. People are still using PHP4 however, the same way people still use COBOL. For new apps you should be looking at PHP5

OTHER TIPS

The PHP manual has a list of changes that will affect backwards compatibility.

Yes, PHP5 is now considered standard.

You shouldn't have any big problems migrating. probably few warnings could appear, but you should be able to quickly resolve it. Check for passing by reference in your code.

Turn error_reporting to E_ALL to see all errors and warnings thrown.

There was a question on this very topic two months back, which had answers giving plenty of good information.

And don't forget, officially, PHP4 is now discountinued. In other words, if a security issure are dicovered in php4, officially no fix will be available.

Support for PHP 4 has been discontinued since 2007-12-31. Please consider upgrading to PHP 5.2. The release below is the last PHP 4 release. Php website

Most headaches will come from the php4 OO model, namely constructor names and method access restrictions. While solving these issues will probably make your code work. In the long run you might want to take advantage of the new OO engine introduced in php5 by doing some refactoring.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top