首先,我按照以下站点上的说明安装 LAMP 服务器:
http://www.multimediaboom.com/how-to-install-lamp-server-in-ubuntu-11-0410-1010-04/#comment-48391
第 3 步:转到http://localhost/phpmyadmin 这不起作用。一开始出现 404 错误,然后在运行“sudo ln -s /usr/share/phpmyadmin /var/www”后出现 403 错误并显示“禁止访问:您无权访问此服务器上的 /phpmyadmin”。
然后最后一步是创建一个简单的 php 文件并测试 php 是否正常工作。我无法将文件保存到 /var/www/
总结一下:
- 如何解决 phpmyadmin 的 403 禁止错误?
- 当 /var/www/ 由 root 所有时,我该如何保存/复制/制作其中的文件?
编辑:
我已设法通过 gksudo 命令启动 gedit 将 test.php 文件保存到 /var/www/。但是当我转到 localhost/test.php 时,它会下载 test.php 文件,而不是在服务器上运行它。
Apache2 错误日志文件内容:
[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
谢谢。
答案1
尝试编辑 apache2.conf 或 httpd.conf
sudo nano /etc/apache2/apache2.conf
确保你有
include /etc/phpmyadmin/apache.conf
alias /phpmyadmin /usr/share/phpmyadmin
并且它们没有注释。我不确定路径。第一个将包含 phpmyadmin 配置文件。第二个将使 phpmyadmin 在 127.0.0.1/phpmyadmin 上可用。我必须查看这些配置文件。尝试不同的方法,每次更改后重新启动 apache:
sudo service apache2 restart
答案2
目录需要是“可执行文件”,请尝试 chmod 0755 /var/www
对于 php,您可能需要执行以下操作:
sudo a2enmod php5
sudo service apache2 restart
回答你的两个问题
- 检查 /var/log/httpd/error.log
- 你可以用 sudo 来写入它们,或者为你的用户创建一个具有适当权限的子目录
值得一读 :
參考文獻:https://help.ubuntu.com/community/ApacheMySQLPHP#Installing_PHP_5