Ubuntu, PHP, NetBeans - part I
This article is about installing PHP environment - PHP, Apache, MySQL and xDebug in Ubuntu 8.04. Everything is available through the default Ubuntu repositories, so it should not be hard. I did this last week, when I prepared a machine for our UI study. It's expected that you have already installed Ubuntu or you use VirtuaBox and you have installed Ubuntu as a virtual machine.
Open a terminal. You will need to install all the parts as root, so you have to execute commands trough sudo or you can in the terminal write command
$ sudo bash
and from this time all what you do in this terminal you do as root. There are the steps for installing the PHP development environment:
- Install Appache web server
apt-get install apache2
- Install MySQL server
apt-get install mysql-server
The installation of MySQL server will ask for password for root user. It's not mandatory, but I recommend to enter a password. - Install PHP 5
apt-get install php5 - Install MySQL extension for PHP
apt-get install php5-mysql - Install xDebug extension for PHP - the extension for debugging.
apt-get install php5-xdebug - Setup the Apache web server to use users web sites
After installing Apache the server should be running. If you click this link http://localhost/ the Firefox is opened and you should see the same content as is on the picture.
But when you try the url, which acces web sites in your home folder, it fails. Instead petr write your username:).
To get it work you have to:- Enable userdir module in Apache web server
a2enmod userdir - Create public_html folder in your homedir (do it uder your account, not as root)
mkdir public_html - Restart Apache web server
/etc/init.d/apache2 restart
If you do it correctly after refreshing Firefox you should see empty content of the folder as on the picture.
- Enable userdir module in Apache web server
- Enable remote debugging in xDebug
In the folder public_html create index.php file with content:<?php phpinfo(); ?>Refresh Firefox and you should see how the PHP runtime is setup. Search for the property xdebug.remote_enable property. By default this property is switched off as you can see on the picture.
To enable this property you have to open file /etc/php5/conf.d/xdebug.ini and add linexdebug.remote_enable=on
and restart the Apache web server/etc/init.d/apache2 restart
This all what you have to install. Now we will set up Apache and PHP.

A cent.... next time use a2enmod instead of the two ugly symlinks... regards
Posted by Marcelo Morales on June 30, 2008 at 11:51 PM CEST #
Thanks Marcelo. I have corrected this in the blog.
Posted by Petr Pisl on July 01, 2008 at 07:36 PM CEST #
A great article - many thanks.
I am 1 day in with Ububtu.
Have installed PHP5, and it works. Can amend the 'xdebug.ini' file but cannot save it. Cannot gain administrator status. All reference materials say admin access can be made through sudo commands, but cannot open editor from there.
Think same problem is preventing the import of ttf files in the fonts directory.
Any help would be appreciated.
Posted by John CLAYTON on July 13, 2008 at 07:47 PM CEST #
Sorry about the post.
Have solved the problem.
Thanks again for article.
Posted by John CLAYTON on July 13, 2008 at 08:05 PM CEST #
sudo tasksel
install lamp and voila php, apache & mysql are installed and configured, except for the xdebug part.
Posted by Doug Holton on July 16, 2008 at 12:13 AM CEST #
your comment system is broken.
I tried to post a response and it says I am using blacklisted words.
Just use sudo tasksel
Posted by Doug Holton on July 16, 2008 at 12:15 AM CEST #
Hi Doug,
thanks for the tip. It's easier. I will try it on fresh ubuntu installation.
And you are right. Your first comment was marked as a spam.
Thanks,
Petr
Posted by Petr on July 16, 2008 at 12:26 AM CEST #
thank u r information
it very useful
Posted by Matthew on October 22, 2008 at 02:46 PM CEST #
<p>many thanks</p>
Posted by lava on November 27, 2008 at 04:51 AM CET #
Thankyou for the tutorial. I have a problem, until "its work" is fine, but after making directory its give 404 error, any thoughts??
Posted by farrukh on March 26, 2009 at 09:05 PM CET #