2

Firstly I followed the instructions on the following site to install the LAMP server:

http://www.multimediaboom.com/how-to-install-lamp-server-in-ubuntu-11-0410-1010-04/#comment-48391

step 3: go to http://localhost/phpmyadmin This did not work. It came up with a 404 error at first then after running "sudo ln -s /usr/share/phpmyadmin /var/www" it came up with a 403 error and said "Forbidden: You don't have permission to access /phpmyadmin on this server".

Then the last step was to make a simple php file and test that php was working. I could not save the file into /var/www/

So to recap:

  1. How do I get around the 403 forbidden error for phpmyadmin?
  2. How do I save / copy / make files in /var/www/ when it is owned by root?

EDIT:

I have managed to save the test.php file into /var/www/ by launching gedit via the gksudo command. When I go to localhost/test.php however it downloads the test.php file instead of running it on the server.


Apache2 error log file contents:

[Tue Oct 04 15:30:27 2011] [notice] Apache/2.2.17 (Ubuntu) configured -- resuming normal operations
[Tue Oct 04 15:30:30 2011] [notice] Graceful restart requested, doing restart
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Tue Oct 04 15:30:30 2011] [notice] Apache/2.2.17 (Ubuntu) configured -- resuming normal operations
[Tue Oct 04 15:31:46 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 15:32:27 2011] [error] [client 127.0.0.1] File does not exist: /var/www/phpmyadmin
[Tue Oct 04 15:32:27 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 15:33:17 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 15:33:17 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 16:55:23 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 16:55:23 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 16:55:25 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 16:55:25 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 16:55:31 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 16:55:31 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 16:55:32 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 16:55:32 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 16:55:33 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 16:55:33 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 16:55:33 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 16:55:33 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 16:55:33 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 16:55:33 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 16:55:52 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 17:06:15 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin
[Tue Oct 04 17:06:15 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[    Tue Oct 04 17:24:34 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 17:24:42 2011] [error] [client 127.0.0.1] File does not exist: /var/www/php
[Tue Oct 04 17:24:42 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 17:25:42 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 17:25:42 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 18:31:45 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Tue Oct 04 19:07:40 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico

Thanks.

Marco Ceppi
  • 48,101
cohen
  • 181

2 Answers2

1

Try editing apache2.conf or httpd.conf

sudo nano /etc/apache2/apache2.conf

Make sure you have there

include /etc/phpmyadmin/apache.conf
alias /phpmyadmin /usr/share/phpmyadmin

And that they are uncommented. I am not sure about the paths. 1st one will include phpmyadmin config file. 2nd will make phpmyadmin available on 127.0.0.1/phpmyadmin. I'd have to see those config files. Try different things restarting apache on each change:

sudo service apache2 restart
0

The directories need to be "executables" try a chmod 0755 /var/www

For php, you may need to do this :

sudo a2enmod php5
sudo service apache2 restart

To answer your 2 questions

  1. Checkout the /var/log/httpd/error.log
  2. You write them with sudo or make a subdirectory with the appropriates permissions for your user

Worth reading :

ref: https://help.ubuntu.com/community/ApacheMySQLPHP#Installing_PHP_5

  • chmod 0755 done no change. -- php said it was already enabled. -- apache restart failed. It could not find the apache.conf file. --
    1. there was no httpd folder -- 2. figured out how to write to the directory thanks.
    – cohen Oct 04 '11 at 07:36
  • Sorry it is /var/log/apache2/, look for the error log to know why you receive theses errors. If you are still unsure, paste them here. – jflaflamme Oct 04 '11 at 07:42
  • Thanks, I'm new to php as well as linux so I posted the error file contents above. – cohen Oct 04 '11 at 10:37
  • I read the link you posted above. it said "If this doesn't work, then it is a problem of file authorisation". Not quite sure what that means. I dont know if I did the chmod correctly though. Do you think I could have step by step instructions for the chmod? Cheers. – cohen Oct 04 '11 at 11:07
  • "chmod: changing permissions of `/var/www': Operation not permitted" How do I change the permissions for this directory? I put a sudo in front of it but I dont think that works (as nothing happened). – cohen Oct 04 '11 at 11:28
  • ok I finally realized you could do it with "sudo su" although it did not help at all. It still downloads the file instead of sending it to php. – cohen Oct 04 '11 at 11:34
  • @cohen For "still downloads the file" please make sure this isn't the issue. – Marco Ceppi Oct 04 '11 at 12:23
  • Hi, nothing will happen as the permissions are now set (yes you need sudo if your not the owner of the directory). You can check that /var/www is in 755 by doing ls -l /var/ you should see next to www: drwxr-xr-x www – jflaflamme Oct 04 '11 at 12:23
  • Checked your edit : Symbolic link not allowed or link target not accessible: /var/www/phpmyadmin. For phpmyadmin under the lamp stack, you should read this : http://doc.ubuntu-fr.org/phpmyadmin espacialy if you don't know about directory permissions under apache, this can be a hard learning curve just to get phpmyadmin to work. But if you want to know about it, this is the FollowSymLinks option. – jflaflamme Oct 04 '11 at 12:27
  • Reconfigure the package phpmyadmin Open a terminal, type

    sudo dpkg-reconfigure phpmyadmin and be sure to select the version of your server HTTP (apache2 normally). When I put that in, it says: "sudo dpkg-reconfigure phpmyadmin Package `phpmyadmin' is not installed and no info is available. Use dpkg --info (= dpkg-deb --info) to examine archive files, and dpkg --contents (= dpkg-deb --contents) to list their contents. /usr/sbin/dpkg-reconfigure: phpmyadmin is not installed"

    – cohen Oct 05 '11 at 07:00
  • do this : sudo apt-get --purge remove phpmyadmin ; sudo apt-get install phpmyadmin ; sudo a2ensite phpmyadmin – jflaflamme Oct 06 '11 at 00:29