Apache出现 You don't have permission to access /phpmya
在 CentOS5.3 MySQL 5.0.45 Apache2.2.3 PHP5.1.6(都是系统自带的)中运行PHP程序出错。 装好 apachephpmysql 后,拷贝(tar / mv )一份 phpmyadmin 过后运行出错: You don’t have permission to access / on this server 有人说把selinux关掉就好了, 的确是
在 CentOS5.3 + MySQL 5.0.45 + Apache2.2.3 + PHP5.1.6(都是系统自带的)中运行PHP程序出错。
装好 apache+php+mysql 后,拷贝(tar / mv )一份 phpmyadmin 过后运行出错:
You don’t have permission to access / on this server
有人说把selinux关掉就好了, 的确是这样。原因是因为网站执行的权限,一般要 Read from all httpd scripts and the daemon这个权限。
1. Apache – Document root must be a directory 问题。
是SELinux的新特性搞的鬼。我把目录或文件设成了user_home_t类型,因此apache的进程没有权限,无法访问。针对 Apache的进程所使用的SELinux target policy规定了apache的进程只能访问httpd_sys_content_t类型的目录或文件。
解决办法:
很简单,把目录或文件的策略类型改成 httpd_sys_content_t 就可以了
使用root用户
$ chcon -R -t httpd_sys_content_t 目录名或文件名
然后可以用命令
$ ls -laZ
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t .
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t ..
drwxr-xr-x root root root:object_r:httpd_sys_content_t admin
-rw-r--r-- root root root:object_r:httpd_sys_content_t adminer.php
drwxr-xr-x root root root:object_r:httpd_sys_content_t phpmyadmin
-rw-r--r-- root root root:object_r:httpd_sys_content_t test.php
$ ll -aZ
$ ll -Z
查看文件目录的策略类型。
注: 只查看目录
$ ls */
$ ll */
$ ll /var/www/html/*/
上一篇: Linux下64位MySQL安装部署过程
推荐阅读
-
You don’t have permission to access /index.php on.
-
对于搭建网站中出现“You don't have permission to access this resource.”错误提示的解决思路
-
You don't have permission to access / on this server,Forbidden
-
CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.
-
wamp不能使用phpmyadmin,提示“You don't have permission to access /phpmyadmin/ on this server.”...
-
Apache启动后出现You don't have permission to access on this server的解决办法
-
PHP错误:Forbidden You don't have permission to access / on thi_PHP教程
-
apache出现You don't have permission to access / on thi_PHP教程
-
Apache出现 You don't have permission to access /phpmya
-
wamp不能使用phpmyadmin,提示“You don't have permission