Apache不从PHP加载模块

时间:2021-07-29 16:54:46

I am following this portuguese article to configure Apache and PHP:

我正在跟踪这篇葡萄牙文,以配置Apache和PHP:

How Install And Configure The Development Environment in PHP - Part 2.

如何在PHP中安装和配置开发环境-第2部分。

I already set up the php.ini and httpd.conf files. Besides to php5apache2_4.dll is in the right directory, but when I restart the server show me the following error:

我已经设置了php。ini和httpd。conf文件。除了php5apache2_4。dll在正确的目录中,但是当我重新启动服务器时,给我显示如下错误:

httpd.exe: Syntax error on line 531 of D:/Apache24/conf/httpd.conf: Invalid LoadModule path \xe2\x80\xaa"D:/php-5.6.13/php5apache2_4.dll"

httpd。exe: D:/Apache24/conf/httpd第531行语法错误。conf:无效的LoadModule路径\xe2\x80\xaa"D:/php-5.6.13/php5apache2_4.dll"

Httpd.conf:

httpd . conf。

LoadModule php5_module ‪"D:/php-5.6.13/php5apache2_4.dll"
AddType application/x-httpd-php .php 
PHPIniDir "D:/php-5.6.13/"

EDIT

编辑

I changed the Httpd.conf file.

我改变了Httpd。conf文件。

LoadModule php5_module ‪"../php-5.6.13/php5apache2_4.dll"
AddType application/x-httpd-php .php 
PHPIniDir "../php-5.6.13/"

And now is returning me a new error:

现在我又犯了一个新的错误:

httpd.exe: Syntax error on line 531 of D:/Apache24/conf/httpd.conf: Cannot load ../php-5.6.13/php5apache2_4.dll into server: %1 n\xe3o \xe9 um aplicativo Win32 v\xe1lido.

httpd。exe: D:/Apache24/conf/httpd第531行语法错误。相依:无法加载. . / php-5.6.13 / php5apache2_4。dll进入服务器:%1 n\xe3o \xe9 um aplicativo Win32 v\xe1lido。

In English language: Not a valid Win32 application.

在英语中:不是有效的Win32应用程序。

In console:

在控制台:

php -version
PHP 5.6.13 (cli) (built: Sep  3 2015 15:14:40)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

httpd -version
Server version: Apache/2.4.16 (Win64)
Apache Lounge VC14 Server built:   Jul 22 2015 13:24:19

7 个解决方案

#1


2  

I just had the same problem trying to configure php7, so for anyone else having trouble:

我在配置php7时遇到了同样的问题,所以对于任何有问题的人:

There may be a few issues. Check that your versions of php and Apache are bit-compatible (both 64-bit x64 or both 32-bit x86; note that when downloading 64-bit PHP from windows.php.net/download/, the zip file will be called php...Win32...x64).

可能会有一些问题。检查您的php和Apache版本是否兼容位(都是64位x64或都是32位x86;注意,当从windows. PHP .net/download/下载64位PHP时,zip文件将被称为PHP…Win32…x64)。

Also check that they are both compiled with the same version of Visual Studio (e.g. VC14). This happened to be the problem here: www.apachelounge.com/viewtopic.php?t=6596

还要检查它们都是用相同版本的Visual Studio(例如VC14)编译的。这恰好是这里的问题:www.apachelounge.com/viewtopic.php?

In my case, I had the problem paulsm4 referred to about quotes. I copied and pasted the code from a website and noticed that when I ran httpd -k start, my error was httpd: Syntax error on line 62 of C:/Apache24/conf/httpd.conf: Invalid LoadModule path \x93c:/php7/php7apache2_4.dll\x94. The \x93 and \x94 are the CP1252 encodings for fancy open and end quotes. Eliminating these or replacing them with regular quotes fixed the problem and Apache ran smoothly with PHP after that.

在我的例子中,我遇到了paulsm4提到的关于引用的问题。我复制粘贴了一个网站的代码,发现当我运行httpd -k start时,我的错误是C:/Apache24/conf/httpd的第62行出现httpd:语法错误。conf:无效的LoadModule路径\x93c:/php7/php7apache2_4.dll\x94。\x93和\x94是CP1252的编码,用于花哨的开引号和结束引号。消除这些或用常规引号替换它们修复了问题,Apache在此之后就可以使用PHP顺利运行了。

Another problem someone else ran into was trying to configure Apache with NTS (non-thread-safe) PHP.

其他人遇到的另一个问题是试图用NTS(非线程安全)PHP配置Apache。

php.net/manual/en/install.windows.apache2.php The PHP download website also makes this point.

PHP下载网站也说明了这一点。

#2


1  

Removing the double-quotes form the httpd_uwamp.conf file worked for me on both UnWamp and PHP distributions. (No spaces are in any of my path names)

从httpd_uwamp中删除双引号。conf文件适用于UnWamp和PHP发行版。(我的路径名中没有空格)

For Example Change

例如改变

LoadModule "{PHPMODULENAME} {PHPPATH}/{PHPAPACHE2FILE}" to LoadModule {PHPMODULENAME} {PHPPATH}/{PHPAPACHE2FILE}

LoadModule“{PHPMODULENAME} {PHPPATH}/{PHPAPACHE2FILE}”到LoadModule {PHPMODULENAME} {PHPPATH}/{PHPAPACHE2FILE}

Thanks to Giancarlo Abel Giulian for his post ;-)

感谢吉安卡洛·阿贝尔·朱安的职位;

#3


1  

I was having the same problem:

我也有同样的问题:

Invalid LoadModule path \xe2\x80\x9cC:/WAMP/php/php5apache2_4.dll\xe2\x80\x9d.

无效的LoadModule路径\ xe2 \ x80 \ x9cC:/里面/ php / php5apache2_4.dll \ xe2 \ x80 \ x9d。

Based on paulsm4 suggestion above, I deleted the quotes in the directive LoadModule php5_module and replaced with simple quotes:

基于上述paulsm4的建议,我删除了指令LoadModule php5_module中的引号,并用简单的引号替换:

LoadModule php5_module "C:/WAMP/php/php5apache2_4.dll"

This solved it for me.

这就解决了我的问题。

#4


0  

Change

改变

LoadModule php7_module "c:/php/php7apache2_4.dll"

to  

LoadModule php7_module /php/php7apache2_4.dll

and   

PHPIniDir "c:/php"

to  

PHPIniDir /php

Well done.

做得很好。

#5


0  

Cannot load modules/php7apache2_4.dll into server: The specified module could not be found. This is a common problem while setting up apache and php environment into a local computer

无法加载模块/ php7apache2_4。dll进入服务器:无法找到指定的模块。在将apache和php环境设置为本地计算机时,这是一个常见的问题

I also faced the same issue: The best way to approach the problem would be to install the same VC level for the apache server and the php and also make sure that the same VC++ is also installed in the computer.

我也遇到了同样的问题:解决这个问题的最佳方法是为apache服务器和php安装相同的VC级别,并确保在计算机中也安装相同的vc++。

For me I tried with VC14 for apache24 and php and also installed VC++ 2015 edition which happens to be VC14

我用VC14测试了apache24和php,还安装了vc++ 2015版VC14

#6


0  

In my case, it was due to the type of PHP7 downloaded: Non Thread Safe Just download the Thread Safe version and extract to C:\php7 (Default directory), then try starting Apache Service again.

在我的例子中,这是由于PHP7类型的下载:非线程安全只是下载线程安全版本和提取到C:\ PHP7(默认目录),然后尝试重新启动Apache服务。

Hope this help!!!

希望这帮助! ! !

#7


0  

I had a similar error du to a simple cut and paste error from an older httpd.conf file where I had

我有一个类似的错误du,一个简单的剪切和粘贴错误来自一个旧的httpd。conf文件。

LoadModule php5_module ...

instead of

而不是

LoadModule php7_module ...

Hope this may help someone else Googling this error message.

希望这能帮助其他人在谷歌上搜索这个错误消息。

#1


2  

I just had the same problem trying to configure php7, so for anyone else having trouble:

我在配置php7时遇到了同样的问题,所以对于任何有问题的人:

There may be a few issues. Check that your versions of php and Apache are bit-compatible (both 64-bit x64 or both 32-bit x86; note that when downloading 64-bit PHP from windows.php.net/download/, the zip file will be called php...Win32...x64).

可能会有一些问题。检查您的php和Apache版本是否兼容位(都是64位x64或都是32位x86;注意,当从windows. PHP .net/download/下载64位PHP时,zip文件将被称为PHP…Win32…x64)。

Also check that they are both compiled with the same version of Visual Studio (e.g. VC14). This happened to be the problem here: www.apachelounge.com/viewtopic.php?t=6596

还要检查它们都是用相同版本的Visual Studio(例如VC14)编译的。这恰好是这里的问题:www.apachelounge.com/viewtopic.php?

In my case, I had the problem paulsm4 referred to about quotes. I copied and pasted the code from a website and noticed that when I ran httpd -k start, my error was httpd: Syntax error on line 62 of C:/Apache24/conf/httpd.conf: Invalid LoadModule path \x93c:/php7/php7apache2_4.dll\x94. The \x93 and \x94 are the CP1252 encodings for fancy open and end quotes. Eliminating these or replacing them with regular quotes fixed the problem and Apache ran smoothly with PHP after that.

在我的例子中,我遇到了paulsm4提到的关于引用的问题。我复制粘贴了一个网站的代码,发现当我运行httpd -k start时,我的错误是C:/Apache24/conf/httpd的第62行出现httpd:语法错误。conf:无效的LoadModule路径\x93c:/php7/php7apache2_4.dll\x94。\x93和\x94是CP1252的编码,用于花哨的开引号和结束引号。消除这些或用常规引号替换它们修复了问题,Apache在此之后就可以使用PHP顺利运行了。

Another problem someone else ran into was trying to configure Apache with NTS (non-thread-safe) PHP.

其他人遇到的另一个问题是试图用NTS(非线程安全)PHP配置Apache。

php.net/manual/en/install.windows.apache2.php The PHP download website also makes this point.

PHP下载网站也说明了这一点。

#2


1  

Removing the double-quotes form the httpd_uwamp.conf file worked for me on both UnWamp and PHP distributions. (No spaces are in any of my path names)

从httpd_uwamp中删除双引号。conf文件适用于UnWamp和PHP发行版。(我的路径名中没有空格)

For Example Change

例如改变

LoadModule "{PHPMODULENAME} {PHPPATH}/{PHPAPACHE2FILE}" to LoadModule {PHPMODULENAME} {PHPPATH}/{PHPAPACHE2FILE}

LoadModule“{PHPMODULENAME} {PHPPATH}/{PHPAPACHE2FILE}”到LoadModule {PHPMODULENAME} {PHPPATH}/{PHPAPACHE2FILE}

Thanks to Giancarlo Abel Giulian for his post ;-)

感谢吉安卡洛·阿贝尔·朱安的职位;

#3


1  

I was having the same problem:

我也有同样的问题:

Invalid LoadModule path \xe2\x80\x9cC:/WAMP/php/php5apache2_4.dll\xe2\x80\x9d.

无效的LoadModule路径\ xe2 \ x80 \ x9cC:/里面/ php / php5apache2_4.dll \ xe2 \ x80 \ x9d。

Based on paulsm4 suggestion above, I deleted the quotes in the directive LoadModule php5_module and replaced with simple quotes:

基于上述paulsm4的建议,我删除了指令LoadModule php5_module中的引号,并用简单的引号替换:

LoadModule php5_module "C:/WAMP/php/php5apache2_4.dll"

This solved it for me.

这就解决了我的问题。

#4


0  

Change

改变

LoadModule php7_module "c:/php/php7apache2_4.dll"

to  

LoadModule php7_module /php/php7apache2_4.dll

and   

PHPIniDir "c:/php"

to  

PHPIniDir /php

Well done.

做得很好。

#5


0  

Cannot load modules/php7apache2_4.dll into server: The specified module could not be found. This is a common problem while setting up apache and php environment into a local computer

无法加载模块/ php7apache2_4。dll进入服务器:无法找到指定的模块。在将apache和php环境设置为本地计算机时,这是一个常见的问题

I also faced the same issue: The best way to approach the problem would be to install the same VC level for the apache server and the php and also make sure that the same VC++ is also installed in the computer.

我也遇到了同样的问题:解决这个问题的最佳方法是为apache服务器和php安装相同的VC级别,并确保在计算机中也安装相同的vc++。

For me I tried with VC14 for apache24 and php and also installed VC++ 2015 edition which happens to be VC14

我用VC14测试了apache24和php,还安装了vc++ 2015版VC14

#6


0  

In my case, it was due to the type of PHP7 downloaded: Non Thread Safe Just download the Thread Safe version and extract to C:\php7 (Default directory), then try starting Apache Service again.

在我的例子中,这是由于PHP7类型的下载:非线程安全只是下载线程安全版本和提取到C:\ PHP7(默认目录),然后尝试重新启动Apache服务。

Hope this help!!!

希望这帮助! ! !

#7


0  

I had a similar error du to a simple cut and paste error from an older httpd.conf file where I had

我有一个类似的错误du,一个简单的剪切和粘贴错误来自一个旧的httpd。conf文件。

LoadModule php5_module ...

instead of

而不是

LoadModule php7_module ...

Hope this may help someone else Googling this error message.

希望这能帮助其他人在谷歌上搜索这个错误消息。