Testing PHP 5.4RC1

The PHP 5.3.7 fiasco really highlighted the need for more people to test PHP release candidates and not wait until the code has been released. This is even more important with PHP 5.4 as there are a number of significant changes to the way PHP works. A release candidate should be tested in two ways: that PHP builds and executes correctly on production web servers and that the HauteLook application works properly. Testing the application is really no different when testing against a release candidate. Building a release candidate to test against can be a little tricky however.

HauteLook uses CentOS on our production web servers and PHP is built by a number of rpm packages from Remi. Unfortunately, Remi does not package up the release candidates as RPM though. This means I need to compile PHP from source while making sure I am configuring everything the same. HauteLook has 24 rpm’s that make up PHP. Trying to manually determine the configuration settings for all of these rpm’s would be a tedious chore. Luckily PHP will tell us the configure command to use. I ran:


php -i |less

I copied the Configure Command section into a file called php-config. Now all I need to do is get the source code:

wget http://downloads.php.net/stas/php-5.4.0RC1.tar.gz
tar xzf php-5.4.0RC1.tar.gz
cd php-5.4.0RC1
sh php-config

This will compile PHP, but not the way I wanted. The Configure Command puts apostrophe’s around each configuration flag and this causes a problem. I used a quick sed command to clean this up:

sed -ie "s/'//g" php-config

The next problem is that I was using a production vm snapshot to test against. I need all of the development packages in order to compile PHP against them. Rather than manually hunting down every package PHP needs to compile against and installing the -devel counterpart, I again used sed to just install the development headers for all packages:

yum list *-devel | sed -ne '/^Installed Packages$/,/^Available Packages$/ p'

Now PHP should compile successfully:

sh php-config
make
make test

The make test portion will run all the tests shipped with PHP against what I now have compiled. It is not uncommon to have some tests fail. There is an option to send an email to the PHP QA team with a list of failed tests and some system information. I encourage you to send this email anytime you are testing.

 

Leave a Reply:

Gravatar Image