简体   繁体   中英

(Apache : couldn't load module) httpd: Syntax error on line 539 of C:/Apache24/conf/httpd.conf:Cannot load C:/php/php7apache2_4.dll into server:

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

I am new to apache and php. I did everything till restarting it. I installed it in C driver. When i try to restart it this happens.

line 539:

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

also I don't actually understand the terms. So can you explain a little more clearly please?

thanks in advance

Apache is a webserver. And it uses several modules, roughly similar to plugins to do the work it was programmed to do.

Your case the error it has thrown is that, the module you have asked apache to load is not found by it . Hence it has thrown the error.

Going by the error, apache seems to have a conflict with your php installation, which has lead to failure in your case. Because you have not menitoned your web server architecture, i am assuming that you built a server around apache and php.

You can try to reinstall php, add essential php extensions for apache-php linkage and try to rectify in case you're building the server.

Below resources can help you in the process:

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

How to enable php7 module in apache?

I faced a similar problem. After installing php 8.0 on Win 32 OS and Apache 2.4. I tried to link php to apache by adding the php module to httpd.conf file of apache. I added the code below to httpd config file.

# PHP8 module
PHPIniDir "C:/PHP"
AddType application/x-httpd-php .php
LoadModule php8_module C:/PHP/php8apache2_4.dll**

After which I tried to restart apache and got an error message in the Apache log error file. Apache refused to start and kept displaying and error message too.

httpd.exe: Syntax error on line 519 of C:/Program Files/Apache Software Foundation/Apache2.4/conf/httpd.conf: Cannot load C:/Program Files/Apache Software Foundation/Apache2.4/modules/php7apache2_4.dll into server: %1 is not a valid Win32 application.

I fixed the error by doing the following. It appears in Apache 2.4 httpd configuration file, php8_module has to be replaced with simply php_module without any number. The code below fixed the error and apache started successfully after modifying the C:\Program Files\Apache Software Foundation\Apache2.4\conf\mime.types file.

# PHP 8.0
PHPIniDir "c:/php"
LoadModule php_module "c:/php/php8apache2_4.dll" 

Add the following line to the end of the mime.types config file

application/x-httpd-php php

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