symfony 1.4.8与PHP 5.4.7和Apache 2.4.3冲突

Fir*_*iam 3 php apache xampp symfony1 symfony-1.4

我最近更新了我的Xampp服务器(从1.7 >> 1.8),从那以后我再也无法运行用Symfony 1.4.8编写的项目了.

它说:

您无权访问所请求的目录.没有索引文档或目录是读保护的.

但它有权限!

实际上它适用于旧版本的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:\AMir\PROJECTS\BarzinMehr\web"
  DirectoryIndex index.php
  <Directory "D:\AMir\PROJECTS\BarzinMehr\web">
    AllowOverride All
    Allow from All
  </Directory>
  Alias /sf C:\xampp\htdocs\symfony\data\web\sf
  <Directory "C:\xampp\htdocs\symfony\data\web\sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这是我的.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>
Run Code Online (Sandbox Code Playgroud)

Fir*_*iam 6

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

像这样更改每个Directory块:

<Directory "your address">
    AllowOverride All
    Allow from All
</Directory>
Run Code Online (Sandbox Code Playgroud)

<Directory "your address">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require all granted
</Directory>  
Run Code Online (Sandbox Code Playgroud)

看来,允许有利于新的指令逐滴要求Apache的2.4(根据对于版本的Apache 2.4的文档)

  • +1用于花时间报告解决方案.第一句话总结了这个网站的用途. (2认同)