Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache doesn't load module from PHP

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

How Install And Configure The Development Environment in PHP - Part 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:

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.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.

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.

In English language: Not a valid Win32 application.

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
like image 344
Giancarlo Abel Giulian Avatar asked Sep 24 '15 17:09

Giancarlo Abel Giulian


1 Answers

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

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).

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

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.

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

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

like image 107
Burrito Avatar answered Oct 05 '22 23:10

Burrito