Ubuntu 7.04: PHP4, you’re fired!

April 25th, 2007 · Filed under Archives

After my upgrade to Xubuntu 7.04, code named Feisty Fawn, I discovered that PHP was not installed. Before the upgrade I was notified that some packages would be uninstalled, including Apache2 web server, which includes the PHP installation.

I tried to install PHP4 using apt-get and aptitude, but I got the message that php4 is referenced by other packages, but there was no package for php4. So I went looking for answers.

I found some notes from Ubuntu developers saying that php4 would be dumped from the repositories, leaving php5 as package. They reasoned that supporting php4 is of no use, since most servers online have already moved to php5.

So I had to install PHP5 on my machine. In the terminal window (Menu -> Accessories -> Terminal) I did the following:

sudo aptitude install apache2 php5 libapache2-mod-php5 php5-xsl php5-gd php-pear

To test if the installation was successful, I created a test.php file to display the php info:

gksudo gedit /var/www/test.php

In this file I added the following line and saved the file.

<?php phpinfo(); ?>

Then I tested to see if it worked by typing http://localhost/testphp.php. It did work, so I removed the test.php file again. After that I installed the MySQL server:

sudo aptitude install libapache2-mod-auth-mysql php5-mysql phpmyadmin

After the installation was finished, I restarted my apache server with

sudo /etc/init.d/apache2 restart

and checked if phpMyAdmin was working: http://localhost/phpmyadmin.

It worked and I was happy to see that my databases were still there, so i didn’t need to restore my backups.

Conclusion
Since there are not too many differences between the 2 versions, switching to PHP5 should be no trouble. There are some new functions that make things easier, so download a php5 manual and continue enjoying PHP.

Related book: Professional PHP5 (Programmer to Programmer)


blog comments powered by Disqus