Fedora 20 配置php 默认路径问题 本帖最后由 lanhaide 于 2014-01-09 23:00:58 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 确定你php环境没问题? $ php -v 没问题啊。如果我在默认的/var/www/html下创建php文件,是可以运行的。 你现在在www/html/ 下新建 index.php<?phpecho phpinfo();?>运行有报错?至于你说的403,$ ll .../www/贴出结果看看或者在配置文件中找到下面两句user deamongroup deamon因为这两句的存在,使得apache并没有权限去读写当前用户的目录,所以会出现权限问题把它们改为user currentUser (其中 currentUser 是当前用户的用户名)group currentGroup (其中 currentGroup 是当前用户所在的组名 如不知道 可用命令 groups "当前用户名" 来查询) 还是不行。按你的步骤走了一遍,现在的情况是地址栏输入localhost可以显示apache默认测试页面(原来不显示),但输入localhost/index.html或index.php仍然报403 forbidden错误。现在的文件结构如下:[root@localhost lanhyde]# ll www总用量 4drwxr-xr-x. 2 lanhyde lanhyde 4096 1月 13 14:09 html[root@localhost lanhyde]# cd www[root@localhost html]$ ls -Z-rw-rw-r--. lanhyde lanhyde unconfined_u:object_r:httpd_sys_content_t:s0 index.php-rw-rw-r--. lanhyde lanhyde unconfined_u:object_r:httpd_sys_content_t:s0 index.php~-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 log.txt-rwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 mypol.pp-rwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 mypol.te[lanhyde@localhost html]$ ll总用量 16-rw-rw-r--. 1 lanhyde lanhyde 20 1月 13 14:18 index.php-rw-rw-r--. 1 lanhyde lanhyde 0 1月 13 14:18 index.php~-rw-r--r--. 1 root root 1278 1月 13 13:58 log.txt-rwxr-xr-x. 1 root root 939 1月 13 14:02 mypol.pp-rwxr-xr-x. 1 root root 219 1月 13 14:02 mypol.te -rw-rw-r--. 1 lanhyde lanhyde 20 1月 13 14:18 index.php更改chmod 755 file or chmod 777 file试试-rwxr-xr-x 1 root root -rwxrwxrwx 1 root root 试过了,不管用贴出你操作之后的效果。抱歉这么久才回复。使用其它网站提供的资料,我已经解决问题了。还是非常谢谢你哈。贴出我的参考地址为有相同问题的童鞋提供点帮助:http://www.if-not-true-then-false.com/2010/enable-apache-userdir-with-selinux-on-fedora-centos-red-hat-rhel/ php大家有没有好的小项目可以推荐给我,就是当练手用的 发现一个phpmyadmin的问题不知道是不是bug,大家看一下 学习PHP的问题 请教一个算法,用服务器调配多客户端 紧急提问2维数组问题,在线等!!!!! 为什么无法输出一张图片 简单的正则,大家帮帮忙 请问这是什么意思? 如何得到php当前执行的页面文件名 為什么我的mail()功能用不了? ecshop二次开发实现的php网站,怎么说实现QQ登录功能实现? 读取文件
<?php
echo phpinfo();
?>
运行有报错?至于你说的403,$ ll .../www/
贴出结果看看或者在配置文件中找到下面两句user deamon
group deamon因为这两句的存在,使得apache并没有权限去读写当前用户的目录,所以会出现权限问题把它们改为
user currentUser (其中 currentUser 是当前用户的用户名)
group currentGroup (其中 currentGroup 是当前用户所在的组名 如不知道 可用命令 groups "当前用户名" 来查询)
[root@localhost lanhyde]# ll www
总用量 4
drwxr-xr-x. 2 lanhyde lanhyde 4096 1月 13 14:09 html
[root@localhost lanhyde]# cd www
[root@localhost html]$ ls -Z
-rw-rw-r--. lanhyde lanhyde unconfined_u:object_r:httpd_sys_content_t:s0 index.php
-rw-rw-r--. lanhyde lanhyde unconfined_u:object_r:httpd_sys_content_t:s0 index.php~
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 log.txt
-rwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 mypol.pp
-rwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 mypol.te
[lanhyde@localhost html]$ ll
总用量 16
-rw-rw-r--. 1 lanhyde lanhyde 20 1月 13 14:18 index.php
-rw-rw-r--. 1 lanhyde lanhyde 0 1月 13 14:18 index.php~
-rw-r--r--. 1 root root 1278 1月 13 13:58 log.txt
-rwxr-xr-x. 1 root root 939 1月 13 14:02 mypol.pp
-rwxr-xr-x. 1 root root 219 1月 13 14:02 mypol.te
更改
chmod 755 file or chmod 777 file试试
-rwxr-xr-x 1 root root
-rwxrwxrwx 1 root root
贴出你操作之后的效果。
抱歉这么久才回复。使用其它网站提供的资料,我已经解决问题了。还是非常谢谢你哈。贴出我的参考地址为有相同问题的童鞋提供点帮助:http://www.if-not-true-then-false.com/2010/enable-apache-userdir-with-selinux-on-fedora-centos-red-hat-rhel/