我一直在尝试在我的Apache Web服务器(localhost)中从php.net设置PHP。
在过去一天半的时间里,我一直在寻找Apache网站上的文档,php.net网站,以及其他任何显示当前错误的文件,试图解决问题。以下是我当前设置和(可能错误)理解的一些细节。
Define SRVROOT "/Apache/00"
ServerRoot "${SRVROOT}"
Apache的公共目录设置为htdocs
。 Apache正在通过localhost
生成其下的目录列表而没有任何问题。只是为了确保我有正确的地址并且它是Apache,我按照下面的描述进行开/关测试。
我运行了为PHP提供的Windows MSI。然后我调整了/conf/httpd.conf
文件添加:
ScriptAlias /php/ "${SRVROOT}/php/"
AddType application/x-httpd-php .php
注意: php
,htdocs
(公共文件)& conf
目录都位于同一目录SRVROOT
的根目录中。
http://localhost/lib/
可能会产生:
Index of /lib
Parent Directory
amd64/
web.jar
x86/
关闭Apache并刷新列表时,我看到了FF错误。
Unable to connect
Firefox can't establish a connection to the server at localhost.
所以Apache本身似乎运行正常,当它运行时我可以进行目录列表。
http://localhost/php/
节目:
Forbidden
You don't have permission to access /php/ on this server.
好的,这似乎合乎逻辑,Apache现在承认该目录的存在,但表示不打算通过公开浏览。
我在phpinfo.php
目录的根目录中包含php
。
<?phpinfo();?>
我希望如果我浏览http://localhost/phpinfo.php
是应该给我信息,而是我收到404消息:
Not Found
The requested URL /phpinfo.php was not found on this server.
对于http://localhost/php/phpinfo.php
我收到禁止的消息:
Forbidden
You don't have permission to access /php/phpinfo.php on this server.
error.log
sl:warn] [pid 1504:tid 336] AH01909: RSA certificate configured for localhost:443 does NOT include an ID which matches the server name
[Sun Aug 04 19:06:01.995343 2013] [ssl:warn] [pid 1504:tid 336] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Sun Aug 04 19:06:02.298078 2013] [ssl:warn] [pid 1504:tid 336] AH01909: RSA certificate configured for localhost:443 does NOT include an ID which matches the server name
[Sun Aug 04 19:06:02.298078 2013] [ssl:warn] [pid 1504:tid 336] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Sun Aug 04 19:06:02.300031 2013] [mpm_winnt:notice] [pid 1504:tid 336] AH00354: Child: Starting 64 worker threads.
[Sun Aug 04 19:06:03.279523 2013] [authz_core:error] [pid 1504:tid 1004] [client ::1:50589] AH01630: client denied by server configuration: I:/Apache/00/php/index.html
[Sun Aug 04 19:15:39.932843 2013] [authz_core:error] [pid 1504:tid 1004] [client ::1:50599] AH01630: client denied by server configuration: I:/Apache/00/php/
[Sun Aug 04 19:21:49.700421 2013] [authz_core:error] [pid 1504:tid 1004] [client ::1:50608] AH01630: client denied by server configuration: I:/Apache/00/php/phpinfo.php
[Sun Aug 04 19:26:58.432843 2013] [authz_core:error] [pid 1504:tid 1004] [client ::1:50621] AH01630: client denied by server configuration: I:/Apache/00/php/phpinfo.php
[Sun Aug 04 19:37:26.403546 2013] [mpm_winnt:notice] [pid 4400:tid 324] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Sun Aug 04 19:37:28.403546 2013] [mpm_winnt:notice] [pid 1504:tid 336] AH00364: Child: All worker threads have exited.
[Sun Aug 04 19:37:28.418195 2013] [mpm_winnt:notice] [pid 4400:tid 324] AH00430: Parent: Child process 1504 exited successfully.
我想显示phpinfo.php
文档。谁能看到我所犯的愚蠢错误(我是新手)?
这些是我一直在关注的主要文档:
答案 0 :(得分:1)
您可能收到权限错误,因为phpinfo.php文件没有设置权限,以便您运行的Apache服务器可以读取它。 Apache可以配置为在运行时将权限删除到受限用户帐户,如果文件的文件安全权限不允许该用户帐户读取该文件,则会收到权限错误。请记住,这适用于最终路径名中的每个目录,即/ Apache和/ Apache / 00和/ Apache / 00 / php和/Apache/00/php/phpinfo.php必须由Apache运行的用户帐户读取下。
另一种可能性是你可能需要在httpd.conf中添加一个Directory指令,以允许访问/ php /,如果你的httpd.conf有一个Directory指令,用于deny-first的默认访问策略。
我也没有看到你在哪里将PHP Apache模块DLL安装到Apache模块文件夹中,也没有提到你在httpd.conf文件中添加模块的地方。如果您不加载PHP模块,PHP文件将无法通过PHP。