Blog: Testing php5.3.0 alpha1

Views:
17173

With the release of php5.3 alpha1 recently I thought it practical that I should set up a vps testing environment. Thought I may as well add a blog entry to coincide with the process.

Starting with a fresh Debian etch install the process is rather simple, of course, you could adapt this to any distro. Firstly, we need to update our apt cache then install some required tools.

# apt-get update && apt-get install sudo bzip2 make build-essential

Next, install Apache, Mysql and any other required libraries.

# apt-get install apache2-dev apache2-mpm-prefork apache2 \
apache2-utils aspell curl libpspell-dev libaspell-dev libbz2-dev \
libc-client-dev libcurl3-dev libfreetype6 libpng3 libpng3-dev \
libfreetype6-dev libjpeg62 libjpeg62-dev libmcrypt4 libmcrypt-dev \
libmhash2 libmhash-dev libmysqlclient15-dev libreadline-dev \
libt1-5 libt1-dev libtidy-dev libxml2 libxml2-dev libxml2-utils \
libxpm4 libxpm-dev mysql-client-5.0 mysql-server-5.0

Next, create an area to work in, download and unpack php's source.

# mkdir src
# cd src
# wget http://snaps.php.net/php5.3-200808052230.tar.bz2
# tar xvjf php5.3-200808052230.tar.bz2
# cd php5*

Configure the build.

# ./configure --with-apxs2=/usr/bin/apxs2 --disable-short-tags \
--with-openssl --with-zlib --enable-bcmath --with-bz2=/bin/bzip2 \
--with-curl --with-curlwrappers --enable-exif --with-gd \
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib \
--with-xpm-dir=/usr/lib --with-t1lib --enable-gd-native-ttf \
--enable-gd-jis-conv --with-gettext --enable-mbstring \
--with-mcrypt --with-mhash --with-mysql=mysqlnd \
--with-mysqli=mysqlnd --with-pdo-mysql --with-pspell \
--with-readline --enable-sockets --without-sqlite \
--enable-sqlite-utf8 --with-tidy --enable-wddx --with-xmlrpc \
--with-kerberos --with-pdo-sqlite --without-pear \
--with-config-file-path=/etc/php5

I've gone a bit crazy here, but it is a test environment.

Make a directory for the php.ini file (this strays from the typical Debain config a little).
# sudo mkdir /etc/php5

The first thing I noticed is that the make install script expects me to have my LoadModules configurations within /etc/apache2/httpd.conf, this isn't the case on Debian, so well just trick it for now.

# echo "LoadModule mod_rewrite /usr/lib/apache2/" \
"modules/mod_rewrite.so" | sudo tee /etc/apache2/httpd.conf

Should be good to go.

# make && sudo make install

Now, we need to add our php5.load file into /etc/apache2/mods-available/ as per the usual Debian setup. The required information is within /etc/apache2/httpd.conf

# grep libphp5 /etc/apache2/httpd.conf | \
sudo tee /etc/apache2/mods-available/php5.load

Empty the /etc/apache2/httpd.conf file as its no longer required.

# cat /dev/null | sudo tee /etc/apache2/httpd.conf

Copy the default php.ini into place, enable the php module and restart Apache.

# sudo cp php.ini-recommended /etc/php5/php.ini
# sudo a2enmod php5 && sudo apache2ctl restart

Create a test file...

# echo '<?php phpinfo(); ?>' | \
sudo tee /var/www/apache2-default/index.php

Thats it! Browse to the file http://servers-ip/apache2-default/index.php and if all went well you'll see a PHP Version 5.3.0alpha2-dev info page.

Now to start playing with namespaces. Enjoy.