This article mainly introduces the solution to the problem that the PHP installation path configuration error under Windows causes Apache to fail to start. This article can be said to be a tragedy caused by quotation marks. Friends in need can refer to it
LoadModule php5_module "C(/D):/Program Files/php5/php5apache2_2.dll" Apache cannot start error caused by PHP installation path
When I installed and deployed a web service on a colleague’s PC today, I put all the program files under program files in the installation directory according to the colleague’s request, so I installed apache under c:program files, and php was also installed under c :program files. After installing MySql and configuring the configuration files of apache and php, I found a problem after restarting. Apache could not start normally.
In view of this reason, I uninstalled and reinstalled the apache+php+mysql environment again, but the problem did not end with the reinstallation - the error remained. Depressed. When I was depressed, I remembered that it was normal to install it in other places. Why can’t it be installed here?
So, I created a new directory under the D drive, deleted all the three previously installed systems, and reinstalled them under the D drive. After the routine configuration was completed, I restarted and it started normally this time.
I saw a green arrow on the red feather of apache, and I was even more depressed. Why does it work on the D drive but not the C drive?
I was confused for a while, then I calmed down and analyzed and guessed for a while. I guess the problem should be that apache uses modularization to load and run the php code:
The code is as follows:
LoadModule php5_module C:/programe files/php/php5apache2.dll
PHPIniDir "C:/programe files/php"
Summary: Apache will execute the content after the spaces as parameters, so paths such as C or D:/programe files.... are obviously not passed under apache.
The above is based on my personal experience after more than 20 minutes of tossing in the Windows environment. I would like to share it with you to avoid making the same mistakes as me again