Home > Article > Backend Development > php cannot load php5apache2_2.dll
Fault phenomenon:
When starting Apache in command prompt mode, the error message "Syntax error on line 122 of D:/Apache/conf/httpd.conf: Cannot load D:/PHP/php5apache2_2.dll into server" is prompted, resulting in Apache cannot start.
The content of line 122 of Apache's configuration file D:/Apache/conf/httpd.conf is:
LoadModule php5_module D:/php/php5apache2_2.dll
PHPIniDir "D:/php"
Note: D:/ PHP/php5apache2_2.dll is the corresponding path where I installed php. Apache is version 2.2.17 and php is version 5.3.6.
The reason for the error:
I found a friend on the Internet who encountered a similar situation and was prompted to know the version of PHP based on the PHP installation file name "php-5.3.6-Win32-VC9-x86.zip" The installation file is compiled by VC, so if you need to run or call the relevant files in the PHP compressed package, you need to install the VC runtime environment first. If your machine does not have a VC runtime environment installed, Apache will prompt the above error message when calling the relevant files in the PHP compressed package.
Solution:
Search "VC2008 Redistributable Components" or "VC2008 Runtime Library" on the Internet, download and install it to solve this fault.
Other reasons and solutions for this error:
Cause: Due to different apache versions, the corresponding "php5apache2.dll" is also different. If you load the wrong "php5apache2.dll", this error message will be prompted .
Example: If you are using version 2.2 of Apache and use the statement "LoadModule php5_module modules/php5apache2.dll" to load PHP, this error will occur. The configuration of this code should be modified to "LoadModule php5_module modules/php5apache2_2.dll" or "LoadModule php5_module "D:/php/php5apache2_2.dll"".
Summary:
Apache2.2 corresponds to php5apache2_2.dll
Apache2.1 corresponds to php5apache2.dll
Apache1 corresponds to php5apache.dll
Due to the above reasons, assuming that Apache2.2 and PHP5.0 are installed, an error will occur Yes, when installing Apache and PHP, you should choose the corresponding version to configure and install.