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.
Related
Well I tried to install PHP 5.5.9 and I followed the procedure in this video exactly: http://www.youtube.com/watch?v=6Y6lOHov3Bk
Basically I pasted these lines in the httpd.conf file, saved and restarted my computer.
# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2_4.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
And now when I try to start Apache it does not work, and the last line in the error log is the following.
(Cannot start Apache (c:/php/php5apache2_4.dll into server: The specified module could not be found)
The only thing I can think is that when I downloaded the PHP 5.5.9 zip file and unpacked it, it did not have the php5apache2_4.dll file so I had to download it from a 3rd party website: http://download12.mediafire.com/9ory5zibr0zg/ncwlddm9cclwc99/php5apache2_4.dll
You don't state whether you have x86 or x64, but the php5apache2_4.dll is only in the Thread Safe binary.
http://windows.php.net/download/
I faced same issue in windows 7 64bit Pro, when installed wampserver3.0.4_x64_apache2.4.18_mysql5.7.11_php5.6.19-7.0.4.exe.
The error in windows Event Viewer (though the file was there) :
The Apache service named reported the following error:
httpd.exe: Syntax error on line 184 of C:/wamp64/bin/apache/apache2.4.18/conf/httpd.conf: Cannot load c:/wamp64/bin/php/php5.6.19/php5apache2_4.dll into server: The specified module could not be found.
Soultion :
Try 1: First installed vc_redist.x64.exe as suggested by others (did not solve the problem)
Try 2:
Modified the below line in C:\wamp64\bin\apache\apache2.4.18\conf\httpd.conf
//old line
#LoadModule php5_module "c:/wamp64/bin/php/php5.6.19/php5apache2_4.dll"
//New line
LoadModule php7_module "c:/wamp64/bin/php/php7.0.4/php7apache2_4.dll"
After this WAMP can start, icon shows green, I can use for my developments.
Note : Another wamp related problem still exists in my system, when I click on the green wamp icon, the wamp menu does not open. I am researching now to resolve it.
The problem is that you need Microsoft VC++ 2012 distributable installed for PHP 5.6 to work. Once you install this, it should work fine for this.
Here is the configuration
LoadModule php5_module "c:/php/php5apache2_4.dll"
<IfModule php5_module>
# configure the path to php.ini
PHPIniDir "C:/php"
AddHandler application/x-httpd-php .php
</IfModule>
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'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".
I'm setting up php and apache on my computer. I have modified my httpd.conf file like my book says (so add these lines:
LoadModule php5_module C:/WebSite/PHP//php5apache2.dll
AddType application/x-httpd-php .phtml .php
)
But when I try to start apache, I get this error: Syntax error on line 129 of httpd.conf Cannot load C:/WebSite/PHP/php5apache2.dll onto server. The specified module could not be found.
The file is definitely in the specified directory. I am new to this, have I done something wrong? Help appreciated :)
EDIT: I actually got the "tumbleweed" badge for this question. Is anyone going to bother looking at it?
I've just had the same error on windows 7 with PHP 5.5 (5.5.0) VC11 and Apache 2.2.22.
The offending line was
LoadModule php5_module "C:/php/php5apache2_4.dll"
and the error was "... line 129 ... The specified module could not be found."
(Yes - I checked that this file existed and all users had access to it!)
I downgraded the PHP to PHP 5.4 (5.4.16) VC9 - making only one change [see below - they seem to have changed the name of the file - between versions] - and it worked fine!
LoadModule php5_module "C:/php/php5apache2_2.dll"
This is a pretty simple fix.
I'm not sure why this works, but
I did notice on http://windows.php.net/download/#php-5.5 that there was some mention of ...
"The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed."
I only have Visual Studio 2008 installed - and this seems to be compatible with VC9 (according to the same site) - which may account for both the problem and the fix?