I'm having trouble with Apache/PHP on Windows 8. I have previously been using them on XP (along with MySQL) with no problems. I never used Windows 7.
Apache installs without issues. Everything works OK, including all my virtual servers.
PHP installs OK, the installation puts entries into httpd.conf without giving errors.
However, when I try to load Apache after installing PHP, Apache won't load.
I'm confused by the error that Apache returns when the PHP entries are included in httpd.conf:
Syntax error on line 1029 of C:/Program Files/Apache Group/Apache2/conf/httpd.conf:
Cannot load C:/Program Files/PHP/php5apache2_2.dll into server: The specified module could not be found.
The lines are:
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "C:\Program Files\PHP\"
LoadModule php5_module "C:\Program Files\PHP\php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
(line 1029 is the LoadModule line).
That location for the dll is definitely correct. The syntax of the line is as inserted by PHP. I have compared the syntax to previous versions of httpd.conf that I have and it appears correct. I think the syntax error is a red herring.
I have tried:
Switching backslashes to slashes in the dll location.
Adding PHP to the path.
Installing Apache and PHP in both sequences.
Checking the permissions to the PHP folder and the individual files
to ensure that SYSTEM has read/execute.
Comment out the PHP lines and Apache loads fine. If I comment out the LoadModule line and and just leave the PHPIniDir line, it still fails. Apache seems to be behaving as though it can't see the PHP directory, but I can't work out why.
There is nothing on the Windows event log. Latest versions of PHP and Apache. I'm at a bit of a loss what to try next. Any suggestions please?
Download and follow instructions from this link:
http://www.apachelounge.com/download/
The latest download (2.4) works on Windows 8 and Server 2012.
I downloaded and tested with the following on Windows 8:
Each zip has a readme.txt or install.txt with instructions.
Apache 2.4
http://www.apachelounge.com/download/win32/binaries/httpd-2.4.3-win32.zip
PHP 5.4.8
http://windows.php.net/downloads/releases/php-5.4.8-Win32-VC9-x86.zip
PHP 5.4.8 handler for Apache
http://www.apachelounge.com/download/win32/modules-2.4/php5apache2_4.dll-php-5.4-win32.zip
My httpd.conf lines that were added/modified were:
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module "C:/Apache24/php-5.4.8/php5apache2_4.dll"
LoadFile "C:/Apache24/php-5.4.8/php5ts.dll"
PHPIniDir "C:/Apache24/php-5.4.8"
<IfModule php5_module>
<Location />
AddType text/html .php
AddHandler application/x-httpd-php .php
#AddHandler application/x-httpd-php-source .phps
</Location>
</IfModule>
Its mentioned in the Readme.txt file packed with the dll's at ApacheLounge, but not anywhere else on the download page or in the filename (as all other versions):
"Runs with PHP 5.4 Thread Safe (TS), and only with Apache 2.4 Win32 VC9 or VC10"
The dlls are only for the TS version, so if you've downloaded the other one, you are basically screwed. TS php binaries fixed it for me.
GL.
Presuming this is your development, not deployment environment, why don't you just download xampp from apache friends? It should come preconfigured, and you will deploy in other setup anyway.
I ran into the similar issue when reinstalling Apache and PHP on Win 8 (I am more Linux user though). And similar to the original post, no matter what I tried to do in httpd.conf and php.ini Apache simply either did not start or did not see the PHP. After spending unreasonable amount of time, I decided to download the PHP 5.3 (5.3.27)-VC9 x86 Thread Safe (2013-Jul-10 21:56:58) Installer [45.86MB] instead of the non-tread safe version which I have been using before. There is a difference in the .msi installers. The one for the thread-safe version actually contains the required files and if you follow the installer prompts it will actually asks you if the php installation should be "linked" to Apache server. Then you just provide the hhtpd.conf directory and all works fine. Thats my 2c on this :)
I think the problem is in the blank "Program Files".
Related
I try to configure Apache 2.4.2 for localhost so that it worked with PHP and PostgreSQL. I added following code to the end of httpd.conf file (updated after #Galadai's answer):
PHPIniDir "D:/Programy/php"
LoadFile "D:/Programy/php/php5ts.dll"
LoadFile "D:/Gis/PostgreSQL/9.3/bin/libpq.dll"
LoadModule php5_module "D:/Programy/php/php5apache2_4.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Trying to start Apache returns an error. When I run "Test Configuration", it shows following error message:
httpd.exe: Syntax error on line 519 of D:/Programy/Apache/httpd.conf: Cannot load D:/Programy/php/php5ts.dll into server: Specified procedure could not be found.
I had some path issues before, and the error message was almost the same, just there was "module" instead of "procedure". I have found quite a few hints for the "module" version, but their solution was usually to make sure whether the paths fit (I did this), both versions are 32/64 bit (both are 32 bit) and PHP is thread safe (it is). I didn't find any hint how to solve the "procedure" version of the error. I thought it might have been caused by difference in versions (I tried Apache 2.2 before), but this proved to be wrong.
EDIT: now I added PHPIniDir and the first LoadFile before the rest of the document ending, and only difference is that now the problem occurs on php5ts.dll too. The path is correct (if it wasn't there would be "module", not "procedure" problem - tested again).
Any other idea?
My PHP is 5.5.9 (thread safe) and PostgreSQL 9.3, my system is Windows XP 32 bit.
EDIT2: workaround through EnterpriseDB LAPP is not as good as I thought for the first time, so I'm still looking for an answer to this question.
According to php.net manual
httpd.conf should look like this:
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "c:/PHP/"
Loadfile "C:\php\php5ts.dll"
Loadfile "C:\php\libpq.dll"
LoadModule php5_module "c:/PHP/php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
I encountered a similar problem. PHP module could not be loaded into my Apache installation.
I used a Windows x64 distribution of Apache 2.4.52 from https://www.apachehaus.com/cgi-bin/download.plx
and PHP version 8.1.2 x64, thread safe from https://windows.php.net/download#php-8.1
And after configuring php extension configuration inside ./conf/httpd.conf,
after running ./bin/httpd.exe, an error returned:
Cannot load C:/Program Files/Applications/php_8_1_2_x64/php8apache2_4.dll into server: The specified procedure could not be found.
SOLUTION: Download a version of apache built with OpenSSL library, as PHP requires this one. LibreSSL won't work.
PHP module wants to internally call the functions of this module but the execution system cannot find the called function (procedure) and reports error.
Replacing bin directory in the Apache server folder with the folder containing correct binaries should work, but I don't know to what extent. Best would be to just set up a new installation and migrate configuration and data files.
There are several questions about this out there, but I have exhausted all fixes and this still doesn't work.
I'm using Windows 7 OS (stupid, I know).
Basically I downloaded PHP 5.2.5 and installed with VC6 (there were some issues with VC9 and up not working with Apache 2.2). I edited the php.ini file to have the following additions:
extension_dir = "C:/php/ext/"
extension = php5apache2_2.dll
extension = php5ts.dll
I then added the php5apache2_2.dll and php5ts.dll files into the C:/php/ext/ directory. These did not come with the PHP download...I had to find them at random places online. Could that be an issue?
The first extension is the PHP module for Apache 2.2. The next one is something I found on a couple of blog posts that sometimes isn't there and needs to be added for PHP to work with Apache.
In the Apache 2.2 httpd.conf file, I added:
LoadModule php5_module "C:/php/ext/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
PHPIniDir "C:/php/"
These are all in the appropriate places, etc. I also set the DirectoryIndex to include index.php
Yes, everything is at the right path/in the right folder.
When I restart Apache, it will never restart unless I comment out the PHPIniDir line. The error log I get is:
Invalid command 'PHPIniDir', perhaps misspelled or defined by a module not included in the server configuration
I'm starting to get a bit lost with all of the supposed "fixes" out there and am afraid of getting in over my head and screwing up my computer (some of the suggestions involve pasting stuff in the system32 folder, etc.).
Can anyone help??
Delete last slash from below line:
PHPIniDir "C:/php/"
I want to install dompdf, and so I need PHP, and consequently Apache (for instance) installed. I've managed to install Apache 2.0.64 on my Windows 7 64 bit. It was apparently working fine, until I've installed PHP 5.4.9 and configured httpd.conf, so Apache could "see" the PHP installation. I've been using this link for guidance on that -> http://www.webdevelopersnotes.com/how-do-i/install-PHP-windows-7.php After that, when I try to start Apache2 the "The requested operation has failed!" error pop-up appears. If I comment the lines that I've inserted into httpd.conf, Apache works again. The lines are:
AddType application/x-httpd-php .php
(...)
LoadModule php5_module "c:/Program Files (x86)/php_5.4.9/php5.dll"
(...)
PHPIniDir "C:/Program Files (x86)/php_5.4.9"
I've spent a lot of hours and searched but couldn't find a similar problem to mine nor a solution of my own. Does anybody has a hint on this?
Thank you very much,
João
I have installed Apache (httpd-2.2.17-win32-x86-openssl-0.9.8o) and PHP (php-5.3.5-Win32-VC9-x86) on Windows XP SP3 and when i use put the PHPIniDir into the Apache configuration file, then Apache won't start, it would crash, and if i removed the directive it works fine but of course doesn't read the PHP configuration.
What might be causing this and what should i do to fix it ?
Here is how it appears inside httpd.conf
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
LoadModule php5_module "D:/Program Files/PHP/php5apache2_2.dll"
PHPIniDir "D:/Program Files/PHP/"
AddType application/x-httpd-php .php .phtml .html
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
based on answer
Open php.ini file with a notepad or any text editor. Disable all of the extension in php.ini file. Comment extensions by one by, and find out which extension causes the problem.
You are using wrong PHP version.
Use VC6 instead of VC9 (at least for this apache version)
I'm trying to configure apache 2.2 for php 5.2 (or preferably 5.3, but php.net seems to say not to) on Windows Server 2008.
C:\Apache2.2\
C:\php\v5.2\
Apache is running fine before I add this to httpd.conf
LoadModule php5_module "C:/php/v5.2/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php/v5.2/"
Then apache spits out this error when I try to restart it from cmd:
httpd.exe: Syntax error on line 129 of httpd.conf: Cannot load C:/php/v5.2/php5apache2_2.dll into server: The specified module could not be found.
It's definitely there!
I googled the error and found a lot of people complaining of it, but they're all for mistakes like referencing php5apache2.dll instead of php5apache2_2.dll.
EDIT: btw, when I use the installer, and it modifies httpd.conf for me, I still get the cannot find error during start up. wtf…
turns out the LoadModule […] has to go at the very end of httpd.conf. dunno why, but i moved it, and apache stopped complaining.