加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

symfony 1.4.8与PHP 5.4.7和Apache 2.4.3冲突

发布时间:2020-12-13 21:46:06 所属栏目:PHP教程 来源:网络整理
导读:我最近更新了我的Xampp服务器(从1.7 1.8),从那以后我再也无法运行用Symfony 1.4.8编写的项目了. 它说: You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected. 但它有权限
我最近更新了我的Xampp服务器(从1.7>> 1.8),从那以后我再也无法运行用Symfony 1.4.8编写的项目了.

它说:

You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.

但它有权限!

实际上它适用于旧版本的Xampp. Symfony 1.4.8是否可能与Apache 2.4或PHP 5.4不兼容?我正在使用Windows 8企业版,但也在Windows 7旗舰版上测试过并存在同样的问题.

任何建议,将不胜感激.

这是我的配置:

NameVirtualHost 127.0.0.1:1111
Listen 127.0.0.1:1111
<VirtualHost 127.0.0.1:1111>
  DocumentRoot "D:AMirPROJECTSBarzinMehrweb"
  DirectoryIndex index.php
  <Directory "D:AMirPROJECTSBarzinMehrweb">
    AllowOverride All
    Allow from All
  </Directory>
  Alias /sf C:xampphtdocssymfonydatawebsf
  <Directory "C:xampphtdocssymfonydatawebsf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

这是我的.htaccess

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line,if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} ..+$
  #RewriteCond %{REQUEST_URI} !.html$
  #RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$index.html [QSA]
  RewriteRule ^([^.]+)$$1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no,so we redirect to our front web controller
  RewriteRule ^(.*)$index.php [QSA,L]
</IfModule>

解决方法

经过这么多天这个问题的挣扎之后,我终于找到了解决办法,我把它放在这里,有利于任何可能面临这个问题的人.根据 this article(感谢作者!)我所要做的就是:

像这样更改每个Directory块:

<Directory "your address">
    AllowOverride All
    Allow from All
</Directory>

<Directory "your address">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require all granted
</Directory>

似乎允许在apache 2.4中取消了新指令Require(根据documentation for version apache 2.4)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读