XAMPP:如何为 PHP 配置 Apache
我的 XAMPP 没有读取我的 PHP。可能是我的 Apache 配置有问题。我的 PHP 书建议我打开 httpd 配置文件并添加以下几行:
LoadModule php5_module c:/php/php5apache2_2.dll
PHPIniDir "c:/php/"
AddType application/x-httpd-php .php
我这样做了,但是当我返回控制面板重新打开 Apache 时,我无法通过它获得运行标志。我认为这是因为我的 PHP 认为我没有使用 XAMPP。我尝试了以下方法:
LoadModule php5_module c:/xampp/php/php5apache2_2.dll
PHPIniDir "c:/xampp/php/"
AddType application/x-httpd-php .php
但问题没有解决(PHP仍然无法工作,我无法在控制面板中获得Apache的运行标志)。我应该怎么办?我正在使用 Windows 7,如果有的话。
卸载XAMPP并删除目录后,我遇到了同样的问题。这是最近的错误日志:
[Fri Oct 15 19:44:00 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 19:44:00 2010] [notice] Digest: done
[Fri Oct 15 19:44:00 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Fri Oct 15 19:44:00 2010] [notice] Server built: Nov 11 2009 14:29:03
[Fri Oct 15 19:44:00 2010] [notice] Parent: Created child process 912
[Fri Oct 15 19:44:03 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 19:44:03 2010] [notice] Digest: done
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Child process is running
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Acquired the start mutex.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting 150 worker threads.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting thread to listen on port 443.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting thread to listen on port 80.
My XAMPP is not reading my PHP. Probably, there's a problem with my Apache configuration. My PHP book suggested that I open the httpd configuration file and add these lines:
LoadModule php5_module c:/php/php5apache2_2.dll
PHPIniDir "c:/php/"
AddType application/x-httpd-php .php
Which I did, but when I went back to the control panel to turn Apache back on, I couldn't get the running sign by it. I figured that this was because my PHP doesn't think I'm using XAMPP. I tried the following instead:
LoadModule php5_module c:/xampp/php/php5apache2_2.dll
PHPIniDir "c:/xampp/php/"
AddType application/x-httpd-php .php
But the problem isn't solved (PHP still doesn't work, I can't get the running sign by Apache in the control panel). What should I do? I'm using Windows 7, if it matters.
After uninstalling XAMPP and deleting the directory, I encountered the same problem. Here's the most recent error log:
[Fri Oct 15 19:44:00 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 19:44:00 2010] [notice] Digest: done
[Fri Oct 15 19:44:00 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Fri Oct 15 19:44:00 2010] [notice] Server built: Nov 11 2009 14:29:03
[Fri Oct 15 19:44:00 2010] [notice] Parent: Created child process 912
[Fri Oct 15 19:44:03 2010] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 15 19:44:03 2010] [notice] Digest: done
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Child process is running
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Acquired the start mutex.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting 150 worker threads.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting thread to listen on port 443.
[Fri Oct 15 19:44:04 2010] [notice] Child 912: Starting thread to listen on port 80.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用从其网站下载的 XAMPP,PHP 应该可以开箱即用。您可以随时尝试从 Source Forge 再次下载它。您始终可以在错误日志中查找错误。
If you are using XAMPP, which you downloaded from their site, PHP should be working right out of the box. You can always try downloading it again from source forge. You can always look in the error log for the error.
确保您没有运行 XAMPP 或任何其他服务器的另一个副本,这可能会导致冲突。
确保 Apache 默认使用的端口 80 没有被其他应用程序(例如 Skype 等)使用。
正如专栏所说,xammp 应该开箱即用,并且 php 已经可以工作。
创建一个像这样的测试 php 页面并将其放入 htdocs 文件夹中
如果您可以转到管理页面,则有一个链接 php.info。看看是否有效。
Make sure you are not running another copy of XAMPP or any other server, This can cause conflict.
Make sure port 80 which is used by Apache by default is not being used by other app such as Skype etc.
As colum said, xammp should work out of the box and php already working.
Create a test php page like this one and put it in htdocs folder
If you can go to the admin page, there is a link php.info. See if it works.