我安装的环境是:
php-5.2.17-Win32-VC6-x86.msi
httpd-2.2.19-win32-x86-openssl-0.9.8r.msi
mysql-5.5.15-win32.msi
windows 7旗舰版
我是一个PHP新手,刚开始学PHP,请高手们指导小弟一下,万分感谢!!!!
郁闷死我了,搞了我好几天时间,网上查了好多别人的经验,就是没找到原因,按照网上的各种配置方法试了好多次,也重装了很多次,还是启动失败,结果发现就是在 D:\Apache2.2\conf\httpd.conf  配置文件中加载了下面的两行代码就不行;LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
PHPIniDir "C:/Program Files/PHP"
如果不加上面两行代码的话就能够正常启动,没有任何问题。我的PHP是安装在C:\Program Files\PHP 这个目录下面的。apache是安装在D:\Apache2.2 这个目录下。现在我实在是发现不了到底是哪里出问题,请高手们帮我看看,谢谢了!!!

解决方案 »

  1.   

    检查php5apache2_2.dll文件是否真的存在你上面的路径内.
    另外复制一下这个文件到你的win7 system32目录内去
      

  2.   


    路径是对的,C:\Program Files\PHP\php5apache2_2.dll
    我也把这个文件复制到了win7 system32目录中,
    还是不行哦。
      

  3.   


    由于日志内容太长发不上来,所以分段发,下面是日志记录第一段:
    Starting the Apache2.2 service
    The Apache2.2 service is running.
    rmine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 21:31:16 2011] [notice] Apache/2.2.19 (Win32) configured -- resuming normal operations
    [Thu Aug 25 21:31:16 2011] [notice] Server built: May 20 2011 17:39:35
    [Thu Aug 25 21:31:16 2011] [notice] Parent: Created child process 3988
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 21:31:17 2011] [notice] Child 3988: Child process is running
    [Thu Aug 25 21:31:17 2011] [notice] Child 3988: Acquired the start mutex.
    [Thu Aug 25 21:31:17 2011] [notice] Child 3988: Starting 64 worker threads.
    [Thu Aug 25 21:31:17 2011] [notice] Child 3988: Starting thread to listen on port 80.
    [Thu Aug 25 21:31:30 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Aug 25 21:31:30 2011] [notice] Child 3988: Exit event signaled. Child process is ending.
    [Thu Aug 25 21:31:31 2011] [notice] Child 3988: Released the start mutex
    [Thu Aug 25 21:31:32 2011] [notice] Child 3988: All worker threads have exited.
    [Thu Aug 25 21:31:32 2011] [notice] Child 3988: Child process is exiting
    [Thu Aug 25 21:31:32 2011] [notice] Parent: Child process exited successfully.
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 21:31:46 2011] [notice] Apache/2.2.19 (Win32) configured -- resuming normal operations
    [Thu Aug 25 21:31:46 2011] [notice] Server built: May 20 2011 17:39:35
    [Thu Aug 25 21:31:46 2011] [notice] Parent: Created child process 2816
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 21:31:46 2011] [notice] Child 2816: Child process is running
    [Thu Aug 25 21:31:47 2011] [notice] Child 2816: Acquired the start mutex.
    [Thu Aug 25 21:31:47 2011] [notice] Child 2816: Starting 64 worker threads.
    [Thu Aug 25 21:31:47 2011] [notice] Child 2816: Starting thread to listen on port 8070.
    [Thu Aug 25 21:32:11 2011] [error] [client 127.0.0.1] File does not exist: D:/Apache2.2/htdocs/favicon.ico
    [Thu Aug 25 21:44:08 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Aug 25 21:44:08 2011] [notice] Child 2816: Exit event signaled. Child process is ending.
    [Thu Aug 25 21:44:09 2011] [notice] Child 2816: Released the start mutex
    [Thu Aug 25 21:44:10 2011] [notice] Child 2816: All worker threads have exited.
    [Thu Aug 25 21:44:10 2011] [notice] Child 2816: Child process is exiting
    [Thu Aug 25 21:44:10 2011] [notice] Parent: Child process exited successfully.
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 21:59:06 2011] [notice] Apache/2.2.19 (Win32) configured -- resuming normal operations
    [Thu Aug 25 21:59:06 2011] [notice] Server built: May 20 2011 17:39:35
    [Thu Aug 25 21:59:06 2011] [notice] Parent: Created child process 672
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 21:59:06 2011] [notice] Child 672: Child process is running
    [Thu Aug 25 21:59:06 2011] [notice] Child 672: Acquired the start mutex.
    [Thu Aug 25 21:59:06 2011] [notice] Child 672: Starting 64 worker threads.
    [Thu Aug 25 21:59:06 2011] [notice] Child 672: Starting thread to listen on port 8070.
      

  4.   


    下面是日志记录第二段:
    [Thu Aug 25 22:06:13 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Aug 25 22:06:13 2011] [notice] Child 672: Exit event signaled. Child process is ending.
    [Thu Aug 25 22:06:14 2011] [notice] Child 672: Released the start mutex
    [Thu Aug 25 22:06:15 2011] [notice] Child 672: All worker threads have exited.
    [Thu Aug 25 22:06:15 2011] [notice] Child 672: Child process is exiting
    [Thu Aug 25 22:06:15 2011] [notice] Parent: Child process exited successfully.
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:06:17 2011] [notice] Apache/2.2.19 (Win32) configured -- resuming normal operations
    [Thu Aug 25 22:06:17 2011] [notice] Server built: May 20 2011 17:39:35
    [Thu Aug 25 22:06:17 2011] [notice] Parent: Created child process 2168
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:06:17 2011] [notice] Child 2168: Child process is running
    [Thu Aug 25 22:06:17 2011] [notice] Child 2168: Acquired the start mutex.
    [Thu Aug 25 22:06:17 2011] [notice] Child 2168: Starting 64 worker threads.
    [Thu Aug 25 22:06:17 2011] [notice] Child 2168: Starting thread to listen on port 8070.
    [Thu Aug 25 22:10:32 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Aug 25 22:10:32 2011] [notice] Child 2168: Exit event signaled. Child process is ending.
    [Thu Aug 25 22:10:33 2011] [notice] Child 2168: Released the start mutex
    [Thu Aug 25 22:10:34 2011] [notice] Child 2168: All worker threads have exited.
    [Thu Aug 25 22:10:34 2011] [notice] Child 2168: Child process is exiting
    [Thu Aug 25 22:10:34 2011] [notice] Parent: Child process exited successfully.
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:20:59 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:23:55 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    [Thu Aug 25 22:23:55 2011] [notice] Apache/2.2.19 (Win32) configured -- resuming normal operations
    [Thu Aug 25 22:23:55 2011] [notice] Server built: May 20 2011 17:39:35
    [Thu Aug 25 22:23:55 2011] [notice] Parent: Created child process 6044
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:23:55 2011] [notice] Child 6044: Child process is running
    [Thu Aug 25 22:23:55 2011] [notice] Child 6044: Acquired the start mutex.
    [Thu Aug 25 22:23:55 2011] [notice] Child 6044: Starting 64 worker threads.
    [Thu Aug 25 22:23:55 2011] [notice] Child 6044: Starting thread to listen on port 8070.
    [Thu Aug 25 22:24:44 2011] [error] [client 127.0.0.1] File does not exist: D:/Apache2.2/htdocs/favicon.ico
    [Thu Aug 25 22:24:47 2011] [error] [client 127.0.0.1] File does not exist: D:/Apache2.2/htdocs/favicon.ico
    [Thu Aug 25 22:24:49 2011] [error] [client 127.0.0.1] File does not exist: D:/Apache2.2/htdocs/favicon.ico
    [Thu Aug 25 22:25:11 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Aug 25 22:25:11 2011] [notice] Child 6044: Exit event signaled. Child process is ending.
    [Thu Aug 25 22:25:12 2011] [notice] Child 6044: Released the start mutex
    [Thu Aug 25 22:25:13 2011] [notice] Child 6044: All worker threads have exited.
    [Thu Aug 25 22:25:13 2011] [notice] Child 6044: Child process is exiting
    [Thu Aug 25 22:25:13 2011] [notice] Parent: Child process exited successfully.
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:26:25 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    [Thu Aug 25 22:26:25 2011] [notice] Apache/2.2.19 (Win32) configured -- resuming normal operations
    [Thu Aug 25 22:26:25 2011] [notice] Server built: May 20 2011 17:39:35
    [Thu Aug 25 22:26:25 2011] [notice] Parent: Created child process 4224
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:26:25 2011] [notice] Child 4224: Child process is running
    [Thu Aug 25 22:26:25 2011] [notice] Child 4224: Acquired the start mutex.
    [Thu Aug 25 22:26:25 2011] [notice] Child 4224: Starting 64 worker threads.
    [Thu Aug 25 22:26:25 2011] [notice] Child 4224: Starting thread to listen on port 8070.
    [Thu Aug 25 22:26:35 2011] [error] [client 127.0.0.1] File does not exist: D:/Apache2.2/htdocs/favicon.ico
    [Thu Aug 25 22:26:36 2011] [error] [client 127.0.0.1] File does not exist: D:/Apache2.2/htdocs/favicon.ico
    [Thu Aug 25 22:26:44 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Aug 25 22:26:44 2011] [notice] Child 4224: Exit event signaled. Child process is ending.
    [Thu Aug 25 22:26:45 2011] [notice] Child 4224: Released the start mutex
    [Thu Aug 25 22:26:46 2011] [notice] Child 4224: All worker threads have exited.
    [Thu Aug 25 22:26:46 2011] [notice] Child 4224: Child process is exiting
    [Thu Aug 25 22:26:46 2011] [notice] Parent: Child process exited successfully.
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:35:34 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:36:16 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    Starting the Apache2.2 service
    The Apache2.2 service is running.
    rmine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:41:08 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:41:15 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    Starting the Apache2.2 service
    The Apache2.2 service is running.
    rmine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:41:31 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:43:47 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:45:21 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:47:23 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    [Thu Aug 25 22:47:23 2011] [notice] Apache/2.2.19 (Win32) configured -- resuming normal operations
    [Thu Aug 25 22:47:23 2011] [notice] Server built: May 20 2011 17:39:35
    [Thu Aug 25 22:47:23 2011] [notice] Parent: Created child process 3528
      

  5.   

    [Thu Aug 25 22:45:21 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?你看看你的logs 目录里是不是 在停掉 apache 后 还有那个 httpd.pid 文件存在.
      

  6.   


    下面是日志第三段:httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    [Thu Aug 25 22:47:23 2011] [notice] Child 3528: Child process is running
    [Thu Aug 25 22:47:23 2011] [notice] Child 3528: Acquired the start mutex.
    [Thu Aug 25 22:47:23 2011] [notice] Child 3528: Starting 64 worker threads.
    [Thu Aug 25 22:47:23 2011] [notice] Child 3528: Starting thread to listen on port 8070.
    [Thu Aug 25 23:05:51 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Aug 25 23:05:51 2011] [notice] Child 3528: Exit event signaled. Child process is ending.
    [Thu Aug 25 23:05:52 2011] [notice] Child 3528: Released the start mutex
    [Thu Aug 25 23:05:53 2011] [notice] Child 3528: All worker threads have exited.
    [Thu Aug 25 23:05:53 2011] [notice] Child 3528: Child process is exiting
    [Thu Aug 25 23:05:53 2011] [notice] Parent: Child process exited successfully.
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 122.71.145.209 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.138.1 for ServerName
    [Thu Aug 25 23:08:24 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 110.96.168.203 for ServerName
    [Thu Aug 25 23:09:08 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 110.96.168.203 for ServerName
    [Thu Aug 25 23:13:33 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 110.96.168.203 for ServerName
    [Thu Aug 25 23:16:22 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 110.96.168.203 for ServerName
    [Thu Aug 25 23:19:19 2011] [warn] pid file D:/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    [Thu Aug 25 23:19:19 2011] [notice] Apache/2.2.19 (Win32) configured -- resuming normal operations
    [Thu Aug 25 23:19:19 2011] [notice] Server built: May 20 2011 17:39:35
    [Thu Aug 25 23:19:19 2011] [notice] Parent: Created child process 2056
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 110.96.168.203 for ServerName
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 110.96.168.203 for ServerName
    [Thu Aug 25 23:19:20 2011] [notice] Child 2056: Child process is running
    [Thu Aug 25 23:19:20 2011] [notice] Child 2056: Acquired the start mutex.
    [Thu Aug 25 23:19:20 2011] [notice] Child 2056: Starting 64 worker threads.
    [Thu Aug 25 23:19:20 2011] [notice] Child 2056: Starting thread to listen on port 8070.
    [Thu Aug 25 23:21:37 2011] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Aug 25 23:21:37 2011] [notice] Child 2056: Exit event signaled. Child process is ending.
    [Thu Aug 25 23:21:38 2011] [notice] Child 2056: Released the start mutex
    [Thu Aug 25 23:21:39 2011] [notice] Child 2056: All worker threads have exited.
    [Thu Aug 25 23:21:39 2011] [notice] Child 2056: Child process is exiting
    [Thu Aug 25 23:21:39 2011] [notice] Parent: Child process exited successfully.
    httpd.exe: Could not reliably determine the server's fully qualified domain name, using 110.96.168.203 for ServerName
      

  7.   


    直接中断掉apache进程之后 删除掉这个文件,然后重新安装apache+php.应该就解决了。(我以前试过是删除掉这个pid,之后重启apache 当然我不确定你的系统是不是可以)
    总之记得 这个文件应该在每次shutdown掉apache 之后就消失的进程文件,如果存在那么你的停止apache也是非正常退出.导致你后面一堆的问题,修改了config 或者php.ini都未能正常生效。
      

  8.   


    啊,不是吧我又得重装?我已经装过好几遍了,晕了。每次装好都没事,只要做一些PHP的配置就这样,所以我现在都害怕重装了,做了好多无用功。以这位仁兄的经验来看,为什么会是这样的原因呢?做什么操作会导致这样的原因出现,我看别人都这么配置,他们能够正常运行,为啥我弄完就不行呢,!!!!!
      

  9.   


    原因我上面说了,就是因为你多次重装 而装的时候这个apache 其实是没有正常退出的 所以就导致你后面如何修改都无效。记住 终止apache的服务 这个pid文件必须自动消失。只有在apache 没有正常启动而又创建了pid的情况下这个pid文件才不会自动消失。反正嘛就是有错误了。完整的解决方案是 终止apache服务. 将自动重启设置为手动 重启系统 删除 这个pid 文件.卸载 apache and php.然后重新安装一次 ok.也不难啊 多简单不是.咔咔...
      

  10.   


    不是.有错误发生多数是在升级或者安装多个apache php版本的时候没有正常的卸载掉旧版本引起的错误
      

  11.   

    SetEnv PHPRC "C:/Program Files/PHP/"
    LoadFile php5_module "C:/Program Files/PHP/php5ts.dll"
    LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
    PHPIniDir "C:/Program Files/PHP"
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps