4

I am stuck again with apache setup guys. I am working on a 64-bit system running Windows 7 professional with service pack 1. I copied the working php5 installation directory from teammates, copied the necessary .dll files from inside php5 installation folder (like they were in the working setup of teammates) to my windows/system32/. Apache server started successfully with the default apache config (httpd.conf) file. I was able to access localhost in browser. But php code was not parsing. I noticed no such line like the following in the apache config file:-

# PHP5 module
LoadModule php5_module D:/php5/php5apache2_2.dll

If I add this line, apache server start fails. Running test configuration gives the following error -

httpd.exe: Syntax error on line 60 of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/httpd.conf: Cannot load D:/php5/php5apache2_2.dll into server: The specified procedure could not be found.  

But the php5apache2_2.dll file is there in the specified location and I have given all permissions to the current system user to the php5 installation directory. The same line also appears in the apache error log. Another thing here is that I am not sure when exactly logs are written to the log file. I am confused if log entries are not made if I have opened the log file for reading? lol ... because I could not observe a pattern in when entries are made. I saw some log entries being made, some not. But that is a separate problem for now.

I had previously setup apache, php on the same system, on another hard disk. I had followed the same steps like I followed now and it did setup successfully, although after a lot of head-scratching, like the log file entry confusion I wrote above. I don't remember how exactly I fixed it earlier. But, I tried with the same apache config file (the one which was working earlier on the previous setup on the old hard disk - had taken a backup), but it still gives the same error.

Update
I read https://www.php.net/manual/en/install.windows.apache2.php and added AddHandler application/x-httpd-php .php right after LoadModule php5_module "D:/php5/php5apache2_2.dll". Still no success.

I also read this blog where some VC6 and VC9 binaries are mentioned. I don't know about them. Do I need to do something about that?

Further Update
I downloaded apache from http://httpd.apache.org/download.cgi - the "Win32 Binary without crypto (no mod_ssl) (MSI Installer)" option.

3 Answers 3

9

Most likely you have incompatible Apache build. You have not mentioned where did you download Apache HTTPD from + what PHP version do you have.

  1. Get latest Apache build from Apache Lounge website -- their builds are compiled with VC9 while apache.org builds are still VC6. You need VC9 build as that is how official PHP builds are compiled now (you can read small explanation on PHP for Windows website -- see link in #2).

  2. Get Thread-Safe build of PHP from PHP for Windows (based on your question you want to run it as Apache module). If you want to run it as FastCGI, then Non-thread safe build is required.

  3. Disable all non-default php extensions (until you successfully start Apache with PHP working).

  4. Configure your PHP and Apache if necessary (those Apache config lines you have mentioned so far are fine).

P.S. "copied the necessary .dll files from inside php5 installation folder (like they were in the working setup of teammates) to my windows/system32/"

  1. You are on x64 bit version of Windows. C:\windows\system32\ is for 64-bit processes/files ONLY. In your case Apache and PHP are x32 so the correct place would be C:\Windows\SysWOW64.

  2. There is no real reason to copy those files there -- you could add your PHP installation path (D:\php5\) to the PATH environment variable (place it in front) and Windows will find all files automatically (restart may be required) -- works fine for me.

P.P.S. Instead of installing it manually, you could use one of the already pre-configured stacks: XAMP, WAMP or similar.

3
  • I downloaded apache from httpd.apache.org/download.cgi - the "Win32 Binary without crypto (no mod_ssl) (MSI Installer)" option. I found the reason... see my answer. I think I have to study your points in detail. For the time being, things are working without me having any proper knowledge of those things :) but I will surely check those. Jul 6, 2011 at 6:35
  • 1
    In my case the problem was that I tried to use php5apache2_2.dll with my apache lounge 2.4.x. After downloading php5apache2_4.dll from the apache lounge website, apache could start up.
    – Zsolti
    Aug 10, 2012 at 13:12
  • The addition of "C:\Program Files\PHP" to the global PATH environment variable did the trick for me (Apache 2.4 and PHP 5.6 on Windows). Had to reboot. Error before was that the curl module could not be loaded.
    – Uwe Keim
    Dec 27, 2014 at 15:16
3

I fixed the problem. Actually absence of some necessary dll files, not sure which particular file, was the reason and I was trying in the absence of a lot of dll files.

What I did was, I had followed the apache configuration part from teammate 1 and then copied the php5 directory from teammate 2 (who was on a 32-bit system with Windows px). I assumed that the php 5 folder would be same and was wrong. The problem got fixed when I took the php 5 folder of teammate 1.

I checked and found there were many differences in the contents of the two php5 folders, mainly dll files. Absence of necessary dll files must have been the issue because I needed a system restart after taking the correct php5 folder of teammate 1.

Moral of the story -
While copying, don't apply brain and copy from the same place :)

2
  • I came here while googling for The specified procedure could not be found. and this "accepted answer" didn't help me a single bit. However @LazyOne 's answer was quite helpful and in my view it should have been accepted as it explains the solutions for your (and similar) problems.
    – maksimov
    Apr 25, 2012 at 13:51
  • I agree.. done :) Apr 25, 2012 at 14:37
3

You don't have to copy any of those (like libeay32.dll, ssleay32.dll) files to anywhere, the problem can just be solved through adding the php installation directory to the system path environment variable.

1
  • set the path environment variable is a good solution
    – jack jin
    Jan 22, 2019 at 1:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .