Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Okay, this is like my fifth time trying to get LAMP set up on Ubuntu, and yes, that includes using XAMPP. (All I want to do is practice my PHP so I can write WordPress plugins! sob Why does the world's easiest language have to be so hard to set up?)

cough Anyway. I used these instructions this time, after uninstalling XAMPP and what were hopefully all traces of my last attempt at doing this. I'm not using Netbeans -- gedit is okay with me -- and I didn't get any error messages or anything, so I thought I'd actually gotten it set up and set to use /home/feathertail/PHP as the document root.

I put a test file in there, browsed to /localhost and got this:


You don't have permission to access /testphp.php on this server.

Apache/2.2.17 (Ubuntu) Server at localhost Port 80

Can anyone point me in the direction of finally solving this once and for all?

share|improve this question
as a test if you set the permissions on that directory to 777, does this solve your problem? – Dirk Hartzer Waldeck Jul 21 '11 at 6:52

To solve this port problem in Linux, go inside the /etc/apache2 folder and there is file ports.conf. Open this in a text editor and you see something like:

NameVirtualHost *:80
Listen 80

so we have to change listen column and make it

NameVirtualHost *:80
Listen 8888

to do this, open a terminal and use these command

cd /etc/apache2 
etc/apache2:#sudo nano ports.conf

Hit Enter, open it in terminal editor in which you just select listen column and change 80 to 8888 like this

NameVirtualHost *:80
Listen 8888

and save it by Ctrl+X and then press Y and then press Enter
now run your apache it will start successfully, it really works.

share|improve this answer

I don't know how did you install files but try to install these files for LAMP

sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php5
sudo apt-get install php5-mysql

Basically nothing need to change (default root: /var/www). but if you want to change root directory then first create your directory.

sudo gedit /etc/apache2/sites-available/default

change Document Root in 4th line. default is /var/www just change to your desire directory. File will be looked like this

DocumentRoot your_DIR

Now logout and login. Your system is ready [apache, mysql-server, php, php-mysql]. You can install additional application phpmyadmin

sudo apt-get install phpmyadmin

start phpmyadmin: go to firefox : localhost/phpmyadmin.

share|improve this answer
To add php in netbeans go to plugin in netbeans and search for php and install. – shantanu Jul 20 '11 at 18:34
The step that I'm having trouble with is changing the document root. Apache works just fine on the default, and so does phpmyadmin. But when I change the document root to /home/feathertail/PHP, I get 403 Forbidden errors when I try to access it. – Tachyon Feathertail Jul 21 '11 at 2:43
sudo chmod 777 /home/feathertail/PHP :place file on this dir and link will be localhost/page.php – shantanu Jul 21 '11 at 16:00
will you please upload this file /etc/apache2/sites-available/default – shantanu Jul 21 '11 at 16:02
Please don't chmod 777 anything without thinking it through. chmod a+x /home/feathertail ; chmod a+rx /home/feathertail/PHP should be enough to get rid of the 403. – SpamapS Oct 26 '11 at 5:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.