当前位置:Gxlcms > PHP教程 > apache中配置php后,无法启动php

apache中配置php后,无法启动php

时间:2021-07-01 10:21:17 帮助过:22人阅读

php的版本是:5.2.17
配置文件代码:
LoadModule php5_module d:/php/php5apache2_2.dll
AddType application/x-httpd-php.php
PHPIniDir "d:/php"
下载的是压缩包,安装在d:/php

出现状况:the requested operation has failed
怎么解决呢?


回复讨论(解决方案)

查看一下apache日志

你安装apache的目录\Apache\logs\error.log

日志内容

Asynchronous AcceptEx failed.
[Mon May 20 13:15:20 2013] [notice] Child 3328:

Released the start mutex
[Mon May 20 13:15:21 2013] [notice] Child 3328: All

worker threads have exited.
[Mon May 20 13:15:21 2013] [notice] Child 3328: Child

process is exiting
[Mon May 20 13:21:11 2013] [warn] pid file

C:/Program Files (x86)/Apache

Group/Apache2/logs/httpd.pid overwritten -- Unclean

shutdown of previous Apache run?
[Mon May 20 13:21:11 2013] [notice] Apache/2.0.64

(Win32) configured -- resuming normal operations
[Mon May 20 13:21:11 2013] [notice] Server built: Oct

18 2010 01:36:23
[Mon May 20 13:21:11 2013] [notice] Parent: Created

child process 1696
[Mon May 20 13:21:11 2013] [notice] Child 1696: Child

process is running
[Mon May 20 13:21:11 2013] [notice] Child 1696:

Acquired the start mutex.
[Mon May 20 13:21:11 2013] [notice] Child 1696:

Starting 250 worker threads.
[Mon May 20 13:21:29 2013] [error] [client 127.0.0.1]

File does not exist: E:/web/myweb/feng.html
[Mon May 20 13:21:30 2013] [error] [client 127.0.0.1]

File does not exist: E:/web/myweb/feng.html
[Mon May 20 13:21:52 2013] [error] [client 127.0.0.1]

File does not exist: E:/web/myweb/febo
[Mon May 20 13:21:56 2013] [error] [client 127.0.0.1]

File does not exist: E:/web/myweb/febo
[Mon May 20 13:21:57 2013] [error] [client 127.0.0.1]

File does not exist: E:/web/myweb/febo
[Mon May 20 13:22:52 2013] [error] [client 127.0.0.1]

File does not exist: E:/web/myweb/\xe9\xa3\x8e

\xe5\xb8\xae\xe7\xbd\x91, referer: http://localhost/
[Mon May 20 13:22:54 2013] [error] [client 127.0.0.1]

File does not exist: E:/web/myweb/\xe9\xa3\x8e

\xe5\xb8\xae\xe7\xbd\x91, referer: http://localhost/
[Mon May 20 13:51:37 2013] [notice] Parent: Received

restart signal -- Restarting the server.
[Mon May 20 13:51:37 2013] [notice] Child 1696: Exit

event signaled. Child process is ending.
[Mon May 20 13:51:37 2013] [crit] Apache is running a

threaded MPM, but your PHP Module is not compiled

to be threadsafe. You need to recompile PHP.
Pre-configuration failed
[Mon May 20 13:51:37 2013] [warn] (OS 995)由于线程退

出或应用程序请求,已中止 I/O 操作。 : winnt_accept:

Asynchronous AcceptEx failed.
[Mon May 20 13:51:38 2013] [notice] Child 1696:

Released the start mutex
[Mon May 20 13:51:39 2013] [notice] Child 1696: All

worker threads have exited.
[Mon May 20 13:51:39 2013] [notice] Child 1696: Child

process is exiting

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
Pre-configuration failed


主要是这句,参考一下:
http://blog.csdn.net/abandonship/article/details/7344918

我换了php-5.2.17-Win32-VC6-x86这个版本,然后按照博客上的步骤安装,为什么还是安装不成功,
不明白下边这句怎么改,是在文件中查找吗?
2. 打开php.ini文件:(添加或打开)

extension_dir = "PHP安装目录\ext"

default_charset = "gbk"

extension=php_mysql.dll
希望给予更加详细的介绍

新手的话建议你安装个wamp,特别好用,我就是新手。

是的,要打开php.ini文件,修改。
extension_dir 应该不需要修改,默认安装时已经设置
default_charset可以换成你需要的。
extension则是找到你想要的,删掉前面的分号;
修改完保存并重启apache(管理工具->服务 找到apache2)。
你所说的“安装不成功”是指什么现象?

我按照韩顺平php视频特意安装了下,安装成功后,对照了下楼主的安装情况,指出不一样。
1.apache 的配置文件,httpd.conf,韩顺平老师配置这么进行配置的(可忽略路径的不同);

PHPIniDir "F:/ampserver/php"
LoadModule php5_module f:/ampserver/php/php5apache2_2.dll

SetHandler application/x-httpd-php

2.接下来,我们要进行的是php的安装。php解压缩后,并没有php.ini这个文件,你所要做的,是要将php.ini-production修改成php.ini(这步是不是没做?).
3.在apache的htdoc文件里,你最好放置一个文件可命名为info.php 该文件就是
phpinfo();
然后你访问下localhost/info.php,看看能不能出现一张表,表里面有没有php,php下面的表格是不是有Loaded Configuration File 这一栏是不是显示了php.ini的路径。如果有,那就php安装成功了。
3.你后面的问题:
打开php.ini文件:(添加或打开)
extension_dir = "PHP安装目录\ext"
default_charset = "gbk"
extension=php_mysql.dll
不明白怎么改,因为这些php.ini的修改主要是针对的是mysql的安装。实现php和mysql接通。
更详细的还是建议你看看韩顺平的php视频教程第25讲-30讲。

我按照韩顺平php视频特意安装了下,安装成功后,对照了下楼主的安装情况,指出不一样。
1.apache 的配置文件,httpd.conf,韩顺平老师配置这么进行配置的(可忽略路径的不同);

PHPIniDir "F:/ampserver/php"
LoadModule php5_module f:/ampserver/php/php5apache2_2.dll

SetHandler application/x-httpd-php

2.接下来,我们要进行的是php的安装。php解压缩后,并没有php.ini这个文件,你所要做的,是要将php.ini-production修改成php.ini(这步是不是没做?).
3.在apache的htdoc文件里,你最好放置一个文件可命名为info.php 该文件就是
phpinfo();
然后你访问下localhost/info.php,看看能不能出现一张表,表里面有没有php,php下面的表格是不是有Loaded Configuration File 这一栏是不是显示了php.ini的路径。如果有,那就php安装成功了。
3.你后面的问题:
打开php.ini文件:(添加或打开)
extension_dir = "PHP安装目录\ext"
default_charset = "gbk"
extension=php_mysql.dll
不明白怎么改,因为这些php.ini的修改主要是针对的是mysql的安装。实现php和mysql接通。
更详细的还是建议你看看韩顺平的php视频教程第25讲-30讲。

不错,看看看啊

还是无法启动,点击start出现对话框:
the requested has failed
我的安装过程:
1.php-5.2.17-Win32-VC6-x86下载完之后解压到d:/php,然后把php.ini-recommended这个文件重命名为php.ini,然后对php.ini进行配置:
extension_dir = "d:\php\ext"
default_charset = "gbk"
extension=php_mysql.dll这句把前面的分号删除;复制php5ts.dll到c:\windows\system32;
2.接着进行httpd.conf的配置,配置文件如下:
PHPIniDir "d:/php"
LoadModule php5_module d:/php/php5apache2_2.dll
AddType application/x-httpd-php.php
配置文件加在#LoadModule ssl_module modules/mod_ssl.so这句的下面。
3.查看logs中的errors.log错误原因是:
Syntax error on line 174 of C:/Program Files (x86)/Apache Group/Apache2/conf/httpd.conf:
Cannot load D:/php/php5apache2_2.dll into server:
也就是说无法连接到d盘中的php文件,这是怎么回事,就是安装在d:/php中。
怎么解决呢?
apache的版本是2.0.64

那你就看看 D:/php/php5apache2_2.dll 这个文件是否存在
如果存在,就检查一下是否有执行权

Apache is running a

threaded MPM, but your PHP Module is not compiled

to be threadsafe. You need to recompile PHP.

你的APACHE是线程安全的 PHP不是

我装了个wamp

谢谢大家的帮忙,等到以后学到一定程度在自己配置吧

x-httpd-php.php 改为x-httpd-php .php 空格啊

人气教程排行