EDITED: 20040107 – Cleaned up the markup to be more xoopish. And added \ marks to the configure example. They simply tell the shell that all of that is really the same command (or line). Note, all of this works with the now current 5.0.3…just so ya know.
Fear not, their Migrating from PHP4 to PHP5 document will certainly make for a great evening read. This helpful document will tour you through all the new features and (known) backwards incompatibilities in this amazing release.
After talking about the exciting new object model for a little while, we discussed to ways to install PHP on your own machine.
The first, using a Windows Installer called WAMP5. If you are using windows and just want an easy to install setup of PHP5, mysql, mysqladmin and apache…look no further. It installs in no time, and seems to do the trick quite nicely. They even have a PHP4 add-on now, so that you can switch between 4 and 5 with ease.
Next, we walked through installing PHP5 as a CGI on an existing PHP4 enabled server. This allows me to continue my day job in PHP4, yet gives me a way to start playing with 5. If you are looking to do something similar in windows, you might check out the this weblog entry on circle.ch.
My process was very similar. Now again, this is in linux, and I like to keep the software that I compile seperate from the software that is installed by my Linux distribution. So, your pathnames may vary. 😉
First, I pulled down the tar ball (php-5.0.0.tar.bz2) from php.net. Then, I went to my build directory and un-tarred it.
[code]$ tar -xvjf ~/php-5.0.0.tar.bz2[/code]
Then, I used the configure command to tell the PHP source a little bit about what I want built in, and where I would like it to go.
You can find more information on php configure options on php.net.
[code]$ cd php-5.0.0
$ ./configure \
// a minute 14 seconds later…
$ make install[/code]
PHP then installs itself…no sweat. You can even run your new php on the command line. If you used the example above, you would run start it like so:
All that is left is to add a new vitual host to your apache.conf
ServerAdmin [email protected]
Allow from all
CustomLog /u01/httpd_data/logs/php5-demo/access_log combined
DirectoryIndex index.php index.html
ScriptAlias /cgi-bin/ “/opt/php5.0.0-cgi/bin/”
Action php5-script /cgi-bin/php
AddHandler php5-script .php .html
Last but not least, you will need to add an entry for your fake server to your /etc/hosts file.
[code]127.0.0.1 localhost tachyon www php5-demo[/code]
Now, just restart your apache and you should be in business.
Put a little index.php (with a or something in it) in /u01/httpd_data/site/php5-demo/htdocs and open your browser to http://php5-demo. You should be greeted by the PHP 5 information!