<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
# Deny from all
#不能有deny from all
Satisfy all
</Directory>
AddType application/x-httpd-php .php
ScriptAlias /php5/ "D:/php5/"
#必须有结尾的“/”
Action application/x-httpd-php "/php5/php-cgi.exe"
#必须为php-cgi.exe
#
如不想设置根目录(“/”)的允许权限(Allow from all)
可以只设置php-cgi.exe的目录为允许访问:
<Directory "D:/php5/">
allow from all
</Directory>
否则运行时会有如下错误提示:
Forbidden
You don't have permission to access /php5/php-cgi.exe/t.php on this server.
这说明apache没有对php-cgi.exe的访问权限。
注:该方法适用于php5.1.X、php5.2.X及php5.3.0,php4.X及以前版本未进行测试。