I am trying to configure PHP 7.4 and Apache 2.4 on my machine, but it is returning the following error:
httpd.exe: Syntax error on line 542 of C:/XIDServer/Apache24/conf/httpd.conf:
Can't locate API module structure 'php7_module' in file C:/XIDServer/php/php7.dll: No error
The bottom of my httpd.conf has the code:
# PHP7 module
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php .html
LoadModule php7_module "C:/XIDServer/php/php7.dll"
PHPIniDir "C:/XIDServer/php"
I’ve done already:
- Copy/paste php7.4 on the location: ‘C:XIDServerphp’
- Edited the php.ini file on ‘C:XIDServerphpphp.ini’, enabling some modules:
- extension=curl
- extension=gd2
- extension=mbstring
- extension=mysql
- extension=pdo_mysql
- extension=xmlrpc
- Created the environment variable for php appointing to ‘C:XIDServerphp’
- Copy/paste Apache 2.4 64 bits to the folder: ‘C:XIDServerApache24’
- Edited the httpd.conf file, to appoint to the new location (‘C:XIDServerApache24’)
- Installed the Windows Service of Apache 2.4
- Added the above lines on the bottom of file ‘httpd.conf’
I’m doing it on a Windows Server 2012 machine.
3
Answers
I’ve had the same issue.
You probably downloaded the Non-Thread-Save version of php7.
However you have to download the Thread-Save version.
Because in this version you will get a file called php7apache2_4.dll which you need to load as a module instead of php7.dll.
If you change this line it should work.
Faced with the problem of missing the php7apache2_4.dll file in the 7.4.11 Non Thread Safe package for Windows. The solution was to choose a package named Thread Safe (Zip archive), which contains all the necessary files for manual installation and configuration. You can download it via the link
You need to download VC15 x64 Thread Safe version from this link