XAMPP:如何为PHP配置Apache

时间:2010-10-15 22:16:25

标签: php apache xampp localhost

我的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.  

2 个答案:

答案 0 :(得分:3)

如果您使用的是从他们的网站下载的XAMPP,那么PHP应该可以直接使用。您始终可以尝试从source forge再次下载。您始终可以在错误日志中查找错误。

答案 1 :(得分:1)

确保您没有运行XAMPP或任何其他服务器的另一个副本,这可能会导致冲突。

确保Apache默认使用的端口80未被其他应用程序(如Skype等)使用。

正如colum所说,xammp应该开箱即用,php已经正常工作。

创建一个像这样的测试php页面并将其放在htdocs文件夹中

<?php
echo "PHP works";
?>

如果你可以进入管理页面,有一个链接php.info。看看它是否有效。