phpmyadmin不能访问,APACEH报403错误的另外一种解决办法

Permission denied: access to /phpmyadmin/ denied

网络上有很多种解决办法,修改CONF文件,停用SELINUX等。

我试过,都解决得不太理想。

通过以下这个贴子,我解决了问题。

URL如下:

http://sanartisan.wordpress.com/2012/04/19/apache-on-centos-6-2-with-sub-directories/

 

The problem was that the phpmyadmin package that I copied via WinSCP took the wrong context, which therefore didn’t have the appropriate permissions for apache to display.

[root@sandbox html]# ls -Z
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 info.php
drwxr-xr-x. root root unconfined_u:object_r:user_tmp_t:s0 phpmyadmin

To fix this, I needed to do the following:

chcon -R -t httpd_sys_content_t phpmyadmin

Note: be sure to use the -R to recursively apply that context against all files. Otherwise you will get a server misconfiguration error.

[root@sandbox html]# ls -Z
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 info.php
drwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 phpmyadmin

In retrospect, had I downloaded the file via wget directly into the /var/www/html directory, it would have already taken the proper context, and I would not have had the issue.

你可能感兴趣的:(php)