Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

Installing PHP on Ubuntu

Any good tuts?

5:38 pm on Feb 25, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 15, 2004
votes: 0

Hey. Does anybody have a good link to a tutorial for installing PHP on Ubuntu Linux? I have installed Apache already, using

sudo apt-get install apache2

[found on ubuntuguide.org]

And I tried using this to install PHP:

sudo apt-get install php4
sudo /etc/init.d/apache2 restart
sudo gedit /var/www/testphp.php

but it didn't work. Besides, I would like to install PHP 5.x.x if possible. Any ideas or tutorials maybe?

9:22 pm on Feb 26, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
votes: 0

I found this:

You can get nice up to date PHP5 packages which work well in Ubuntu Hoary by adding the following lines to your /etc/apt/sources.list

deb [people.debian.org...] php5.0 hoary
deb-src [people.debian.org...] php5.0 hoary

Just run apt-get update and then they will appear in apt.

Then you should be able to:

sudo apt-get install php5
sudo /etc/init.d/apache2 restart
sudo gedit /var/www/testphp.php

You'll need to verify that /var/www is where your server is looking for requests. In my Apache install it was /var/www/localhost/htdocs by default, which I changed in my httpd.conf (Apache configuration file).

You're probably gonna need mod_php too:

sudo apt-get install libapache2-mod-php4(or 5)

9:59 pm on Feb 26, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 28, 2002
votes: 0

I'm going to install Apache2 and php5 on Ubuntu as a production environment in the next couple of days and I'm just going to install the Ubuntu builds via Synaptic Package Manager. I've already installed the cli version of php5 this way and it works just fine.