Should I Migrate to PHP5?

I noted some sites started pushing to PHP5 with the announcement last year that PHP4 would be EOL (end-of-life) in 2007. In truth I understand that there is no longer a compelling reason to remain with PHP4. The biggest obstacle was older software that did not support PHP5 (since version 5 is incompatible with version 4 in some respects). However there is no reason why most of that software cannot be updated, and if so I am pretty sure that some alternate version 5 compatible software exists. I also read some claims that in simpler configurations PHP4 could be faster/less memory than PHP5. I don’t know if that’s true or not. Finally the biggest problem: most web hosting providers are content with PHP4 meeting all their needs and have no reason to upgrade. I do agree to this in some ways.

My biggest problems with PHP in general are its very poor track record for security, its flaws in design/configuration and finally it’s tendency to break software on updates. In some ways: its just a nuisance to maintain!!! PHP4 will be supported for critical security issues till 2008-08-08 by the PHP developers. However being open source there is no reason why someone else could not support it after that. Redhat Enterprise Linux still supports a PHP 4.3.9 package. I was supporting a 4.3.11 package for Fedora which I updated last in 2007 for Fedora 7. However I only installed it on my personal web server on a development box. I guess it would be really easy to finally abandon supporting old packages and just move to version 5, however I don’t know the effect it may have on my public server with a dozen or so websites.

For now I will set a deadline for myself to migrate to PHP5 by the August deadline. However for the time being, if people would find it useful I am considering repackaging the RHEL PHP 4.3.9 for Fedora 8. My 4.3.11 package is greatly out of date. On my development server, I’ll just go ahead and install the PHP5.2 included in Fedora 8. That will be my testing ground for my server updates coming soon.

Realistically in the long run I should just slowly stop using PHP altogether, given that PHP6 will be another mess very soon. Perhaps I will look into Python or J2EE options, not sure yet.

PHP4 on Fedora Core 6

The need for PHP4 has not changed much since Fedora Core 5 (FC5). Hence I have taken the time to update the SRC.RPM that I had originally distributed for FC5 to support Fedora Core 6 (FC6). Included are several security updates as well. FC5 users who used this file previously should update.

The updated source RPM package is provided on the following guide:

PHP4 on Fedora Core 6

Steps provided should work for FC6, FC5 as well as FC4. Although no testing was done for FC4. There are some precompiled binary RPM’s provided as well. (The binaries MAY be out of date.)

As always, these have only minimal testing by myself. Furthermore, please take care when using these files on production servers.

PHP4 on Fedora Core 5 x86_64

I do not know how many people require PHP4 on Fedora Core 5. However since I find that I use it, I am providing PHP4 binary RPMs.

Since I made the files available I did receive some complaints. Primarily a compile failure on x86_64 architecture and a compile failure on PPC architecture. I have no means to test PPC, however I have tested with x86_64 and had success.

For x86_64 architecture, I have tested the src.rpm against the default FC5 rpm’s and the latest updated rpm’s (as of 08 July 2006), both work without problem.

PHP4 on Fedora Core

PHP4 on Fedora Core 5

Apparently some developers still require PHP4 on their web servers. The previous method for doing so on Fedora Core 4 (FC4) was to use the FC3 RPM’s. (A formal procedure was provided by the guide: PHP4 on FC4.)

Since the release of FC5, the dependancies and outdated linking from the FC3 RPM packages may be difficult to resolve. It is recommended to recompile the PHP4 SRC.RPM and link it to the running software provided in FC5. However, there are some needed changes to the SRC.RPM. There is a modified source RPM package provided on the following guide:

PHP4 on Fedora Core

Steps provided should work for FC5 as well as FC4. There are some precompiled binary RPM’s provided as well.

These have only been tested by myself. I would appreciate it if anyone can report as to how well these work!

PHP4 RPMs for Fedora Core 4

EDIT (Dec 19, 2005):
I have written a formal guide on PHP4 on FC4.

As a followup to my previous post about PHP4 on FC4, I decided to abandon PHP5 altogether. I spent some time to try and get the PHP4 src.rpm from FC3 to compile correctly in FC4. As it turned out neither the GCC4 nor the GCC3.2 included in FC4 would compile everything properly. So I decided to try GCC3.4 (which I installed from source long ago when first tweaking with FC4).

Anyways it worked. I have 15 RPM files which I don’t think I will upload unless someone really cares for them. I’ve only done this in the process of seeing if there is an advantage in using my own compiled RPM’s as opposed to using the FC3 RPM’s. Right now I don’t think that there is.

Recommended Method:
In the end if you force uninstall all PHP5 RPM files in FC4, and then you install the FC3 PHP4 RPM’s, it does work.

[root]# rpm -e php-imap php-ldap php-mysql php-pear php

Install any PHP4 RPM you want from Fedora Core 3 Updates. Make sure to install the php and php-pear RPM files together.

PHP4 on Fedora Core 4

EDIT (Dec 19, 2005):
I have written a formal guide on PHP4 on FC4.

One of my biggest difficulties with using Fedora Core 4 was that it packages PHP5 with the Apache webserver. Any experienced person should know that Fedora Core is probably a terrible Linux Distribution to be using for a large scale Web Server on the Public Internet. However, it may be sufficient for home or Intranet usage.

What I like to do is, I mirror my public main site mjm wired on my home Linux computer. This was very easy with FC1 – FC3, however PHP5 broke several things in my PHP code. I tried fixing most of them, but it wasn’t worth the effort since my current hosting provider is still on PHP v4.3.10. Anyways, I tried meddling with the PHP4 RPM in FC3 – that was no good. Then I tried recompiling the source RPM for FC3 (src.rpm), but that caused too many compiler errors and with over 60 lines of configure options to compile I couldn’t figure out all the dependancies and flags to satisfy the compile. I had some problems with some XML libraries.

In the end I just compiled the tar.bz2 with some minimal settings. I set the install directory to use /opt/php4 so as not to disturb PHP5. It properly installs the PHP4 Apache Module in the correct location. Then I had to edit /etc/httpd/conf.d/php.conf to disable PHP5 and enable PHP4. So now Apache2 on FC4 runs PHP4 correctly for me. I know there is some way to run them in parallel with controlling certain directories and controlling certain Types (.php, .php4, .php5), but I don’t require this at the moment.

I might write a formal process on this later when I get the time. However, I do think that there MUST be a better way to do this, I am open to suggestion or tips.