简体   繁体   English

在 Windows 10 上安装 PHP7 和 Apache2.4 - php7apache2_4.dll 错误

[英]Installing PHP7 and Apache2.4 - php7apache2_4.dll error on Windows 10

Just got on a Windows 10 and after I configured my php.ini and http.conf I went on the command line httpd.exe and got this error message:刚刚在 Windows 10 上配置好 php.ini 和 http.conf 后,我进入命令行httpd.exe并收到此错误消息:

httpd.exe: Syntax error on line 530 of C:/Apache/conf/httpd.conf: Cannot load C:/php/php7apache2_4.dll into server: The specified module could not be found.

I KNOW this file is in that folder.我知道这个文件在那个文件夹中。 I've installed both 64 bits version of PHP and Apache and I don't know what's going on.我已经安装了 64 位版本的 PHP 和 Apache,但我不知道发生了什么。

Check whether you have installed Thread safe version of PHP.检查您是否安装了线程安全版本的 PHP。 Non Thread safe version will cause this error.非线程安全版本将导致此错误。

You can download thread safe version of PHP here您可以在此处下载线程安全版本的 PHP

当您下载 PHP 时,您应该选择 ThreadSafe 包,Apache 不支持 nonThreadSafe...

正如其他人所说,非线程安全(nts)不支持 apache,您必须安装线程安全版本

Which VC compiled version of Apache do you use?您使用哪个 VC 编译版本的 Apache? On php.net they recommend to use the apache server from apachelounge.com combined with the threadsafe php files.php.net 上,他们建议使用来自apachelounge.com的 apache 服务器以及线程安全的 php 文件。
Also make sure that you have installed the C++ Redistributable Visual Studio 2015.还要确保您已安装 C++ Redistributable Visual Studio 2015。
If it still fails with that error make sure the user who is starting the process has access to the filesystem.如果它仍然因该错误而失败,请确保启动该进程的用户可以访问文件系统。

I was able to overcome this error by uninstalling my previous version of wampserver , then installing the latest version (3.2.0), closer to the php7.4.9 target.我能够通过卸载我以前版本的 wampserver 来克服这个错误,然后安装最新版本(3.2.0),更接近 php7.4.9 目标。

As I previous had php 7.2 with an earlier version of wampserver (can't remember which), none of the above tricks would work for me.由于我以前使用过 php 7.2 和较早版本的 wampserver(不记得是哪个),因此上述技巧都不适用于我。 I was still getting the error of this topic title.我仍然收到此主题标题的错误。 Now working ok .现在工作正常

Reminder : to integrate an external version of php into wamp, rename php.ini-development in folder php7.4.9 into phpForApache.ini提醒:要将外部版本的 php 集成到 wamp 中,请将 php7.4.9 文件夹中的 php.ini-development 重命名为 phpForApache.ini

I'm not sure if this is the same problem, but I had an issue that the Apache httpd service would not start when I tried to add the php module to an apache server (httpd.conf).我不确定这是否是同样的问题,但是当我尝试将 php 模块添加到 apache 服务器 (httpd.conf) 时,我遇到了 Apache httpd 服务无法启动的问题。 The service would not start.该服务将无法启动。 When I looked at the Event Viewer I found an application error event indicating that the service terminate unexpectedly, and it indicated that the problem occurred in Apache24\\bin\\libapr-1.dll.当我查看事件查看器时,我发现了一个应用程序错误事件,表明服务意外终止,并且表明问题发生在 Apache24\\bin\\libapr-1.dll 中。

The problem was with the LoadModule statement that I added at the end of my httpd.conf file.问题出在我在 httpd.conf 文件末尾添加的 LoadModule 语句。 Here's what I orginally had:这是我最初拥有的:

LoadModule php7_module "C:\\PHP7\\php7apache2_4.dll" LoadModule php7_module "C:\\PHP7\\php7apache2_4.dll"

Here's what I changed it to:这是我将其更改为:

LoadModule php7_module C:\\PHP7\\php7apache2_4.dll LoadModule php7_module C:\\PHP7\\php7apache2_4.dll

Low and behold, the apache service started, any I was able to execute the phpinfo.php sample script that I added to the Root Document directory.瞧,apache 服务启动了,我可以执行添加到根文档目录中的 phpinfo.php 示例脚本。 (By the way, forward or backward slashes both work.) (顺便说一句,向前或向后斜线都有效。)

The difference is that I removed the quotes.不同之处在于我删除了引号。 The quotes were there because I had just copied and pasted from a web page that said how to install PHP.引号在那里是因为我刚刚从一个说明如何安装 PHP 的网页中复制和粘贴。

我有一个类似的问题,当我查看 apache24 错误日志时,它说了一些关于 PHP 的警告:'vcruntime140.dll' 14.0 is not compatible with this PHP build links with 14.16 in Unknown etc. 我已经安装了一个版本的 vcredist 但显然它需要更新的版本并在这里找到解决方案: vcruntime140.dll 14.0 not compatible with PHP build

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM