Apache doesn't load module from PHP

Apache doesn't load module from PHP

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Apache Doesn't Load Module from PHP

When configuring a Windows-based development environment, mixing different versions of Apache and PHP often leads to cryptic errors that stop you cold. A common stumbling block appears when trying to load the PHP module via LoadModule. In the scenario described, the user has successfully set up their php.ini and httpd.conf files but encounters a specific syntax error regarding the path to the DLL file.

The initial error message indicates a fundamental misunderstanding of how Apache parses paths on Windows:

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"

The key phrase here is Invalid LoadModule path. Apache expects the path in a LoadModule directive to be an absolute, unquoted string or a relative path without extra formatting. When you quote the path with double quotes like "D:/php-5.6.13/php5apache2_4.dll", Apache attempts to interpret the contents of that file as the module name rather than treating it as a filename. This is a parsing quirk specific to older configurations or certain builds of the Apache server on Windows.

The immediate fix is to strip the quotation marks. The corrected line should look like this:

LoadModule php5_module D:/php-5.6.13/php5apache2_4.dll
AddType application/x-httpd-php .php 
PHPIniDir "D:/php-5.6.13/"

Once the quotes are removed, Apache successfully locates the file but faces a new hurdle. The error shifts to:

Cannot load ../php-5.6.13/php5apache2_4.dll into server: %1 não é um aplicativo Win32 válido.

Translating this Windows System Error 197 (%1 is not a valid Win32 application) reveals the core architectural mismatch. Your Apache server logs show it is running as a 64-bit process (Apache/2.4.16 (Win64)), while your PHP module was likely compiled for the 32-bit architecture.

Windows handles 32-bit and 64-bit binaries strictly. A 64-bit process cannot load a 32-bit DLL, and vice versa. Even if you resolve the syntax error by correcting the path, Apache will refuse to load the module because the binary incompatibility prevents the operating system from executing the file.

To resolve this, you must ensure that your PHP build matches the architecture of your Apache installation. If you are using a 64-bit version of Windows with a 64-bit Apache (which is standard for modern systems), you need to download or compile PHP specifically as php5apache2_4.dll for the x64 platform.

It is also worth noting that mixing paths, such as switching from an absolute path (D:/...) to a relative one (../...) without adjusting the working directory of Apache, can lead to further confusion. While relative paths are valid in some contexts, consistency is key during troubleshooting. Sticking to absolute paths prevents ambiguity about where the server is looking for resources.

If you are building a new environment from scratch, consider using official binaries provided by Windows Web Platform Installer (WPI) or verified distributions like XAMPP or Laragon, which handle these architecture alignments automatically. For custom setups, always verify the target architecture of your web server before attempting to load a PHP module. If you encounter similar issues while integrating PHP into a larger Laravel project, ensuring that your underlying system components match is just as critical as configuring your composer.json.

Our network