简体   繁体   中英

Cannot load C:/php/php7apache2_4.dll into server: %1 is not a valid Win32 application

So almost all the time, this problem is down to a mismatch of Windows x32/x64 versions of Apache and PHP or the respective Binary versions. But I've triple checked and quadruple checked that they are the correct versions. So now I'm thoroughly stumped.

Here's the lines I added to the bottom of the httpd.conf file:

AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .html .htm
LoadModule php7_module "C:/php/php7apache2_4.dll"
PHPIniDir "C:/php"

Without this, Apache runs completely fine. But then when I add this bit to install PHP, the following error comes up:

httpd: Syntax error on line 535 of C:/Apache24/conf/httpd.conf: Cannot load C:/php/php7apache2_4.dll into server: %1 is not a valid Win32 application.

The versions I downloaded are:

httpd-2.4.29-Win64-VC15
php-7.2.1RC1-Win32-VC15-x64

I believe these are compatible bit and binary versions. Win64 and VC15 for both (I am confident the "Win32" in php download doesn't signify a Win32 version after spending much time researching if that was my problem).

Any ideas what is going on here?

Thanks.

No idea what the explicit problem was but I just deleted all PHP files I downloaded and redownloaded/unzipped them, just like I did originally, placed them in corresponding folders like they were before and it works now.

Still very perplexed by why I had to do that for it to work but it works now which is all I wanted.

Good day!

Download the php compatible with your version of Windows. For example: If you are using win32 or win64 bit, download php on this version of Windows.

Had the same problem. Here's what fixed it for me:

Change the line:

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

to:

LoadModule php7_module C:/php/php7apache2_4.dll

Yes, just remove the quotes!

I had the same issue, version incompatibility.

  1. I downloaded the 32 bit version of PHP
  2. Removed the double quotes in the line LoadModule php7_module "C:/php/php7apache2_4.dll" to LoadModule php7_module C:/php/php7apache2_4.dll

It worked for me, Hope it works for you too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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