php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #18129 Installation PHP 4.2.X with Apache 2.0.x
Submitted: 2002-07-03 04:55 UTC Modified: 2004-08-25 18:34 UTC
Votes:49
Avg. Score:4.8 ± 0.6
Reproduced:43 of 44 (97.7%)
Same Version:37 (86.0%)
Same OS:39 (90.7%)
From: erik at antwerpes dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.0-dev OS: Win32
Private report: No CVE-ID: None
 [2002-07-03 04:55 UTC] erik at antwerpes dot de
Hi guys,

the documentation (install.txt) for php to work with apache 2 is not so good
and
so it took a lot of time for me to make it works.

I want to use php as sapi module in apache 2. So I took the three line
from the documentation:

   LoadModule php4_module c:/php/sapi/php4apache.dll
   AddModule mod_php4.c
   AddType application/x-httpd-php .php

modified the path-statements and change the module name to
new php4apache2.dll.
I restarted apache an I got only errors.
I tried also a new one of the module which I got from
http://ftp.proventum.net/pub/php/win32/php4.2.x-apache2.zip
 but the result was the same. Always errors.

After a lot of hours of searching and trying, I changed the three lines and
used only the next two ones:

   LoadModule php4_module c:/php/sapi/php4apache.dll
   AddType application/x-httpd-php .php

And everything was fine and it's still working. I took so much time!!!

There a so many questions in the newsgroups so please make a hint in
the next version of the documentation how to use the module with apache2.

Regards

Erik



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-03 04:59 UTC] erik at antwerpes dot de
THERE was an ERROR when I wrote this.
The name of the modukle must be "php4apache2.dll"
the hole statement is:

   LoadModule php4_module c:/php/sapi/php4apache.dll
   AddType application/x-httpd-php .php

Regards

Erik
 [2002-07-03 05:07 UTC] erik at antwerpes dot de
SHIT, I'm stupied: ;-((
Now it's right!!:

   LoadModule php4_module c:/php/sapi/php4apache2.dll
   AddType application/x-httpd-php .php
 [2002-07-05 00:20 UTC] rtfm at bigpond dot net dot au
Glad he got it working.
I am on Windows XP and I get a version mismatch with apache 2.0.39

Regards

Kevin
 [2002-07-10 09:22 UTC] christophe at ponsen dot be
To use PHP 4.2.1 under Apache 2 instalaltion, don't forget to download the new DLL related here because the one in the installation pack is not right.  

http://ftp.proventum.net/pub/php/win32/php4.2.x-apache2.zip
 

Go and Get it or PHP will never go on.
 [2002-07-12 22:50 UTC] cesar at bjs dot com dot ar
Thanks for http://ftp.proventum.net/pub/php/win32/php4.2.x-apache2.zip
Work fine!!!
 [2002-07-13 01:05 UTC] philip@php.net
install.txt should mention something about apache2 (currently it's not afaict), like how about:

(a) php4apache.dll is for apache1.x.x not apache2
(b) php4apache2.dll is for apache2 but
(c) apache2 support is experimental in PHP

Also, is this report saying that the distributed apache2 dll is broken?  Please verify.

* http://cvs.php.net/cvs.php/php4/win32/install.txt
 [2002-07-13 22:19 UTC] jhansch1 at elp dot rr dot com
I'm having problems with Apache 2.0.39 and PHP 4.2.1.

I downloaded the new php4apache2.dll and put it in the sapi folder, and added the lines:

####  START PHP
LoadModule php4_module "C:\Program Files\Apache Group\PHP\sapi\php4apache2.dll"
AddType application/x-httpd-php .php .phtml .php3
####   END  PHP

into my httpd.conf.  The path to the file is correct, but whenever I try to start it, I get an error.  When I run the test-configuration link in the apache program group, it says it "cannot find the module" but the file is there :\  Anyone have any other ideas?
 [2002-07-13 22:31 UTC] philip@php.net
jhansch1, this bug report already has two bugs to deal 
with, they are:
a) index.txt lacks apache2 docs (confirmed)b) A possible broken php4apache.dll (doubtful, try latest)
Please don't bring other issues into this bug report and ask support questions to php.net/support
 [2002-08-06 02:32 UTC] db at webgate dot net
To clarify.

Yes, the supplied module (dll) php4apache2.dll does not work properly.
I cannot say as to what the issue is with is, other than it does not load properly or at all.

This is what I did for it to work.  You can download and check the modified DLL file (not mine) and see how it was fixed/modified.

------------------------
Link: http://freemirc.com/miki/php4apache2.dll

Download and replace it, with the existing one in your
"x:\php\sapi"

AFTER THAT change/add these lines to htppd.conf

LoadModule php4_module x:\php\sapi\php4apache2.dll
AddType application/x-httpd-php .php .php3 .php4 .phtml
------------------------

Worked for me and for good measure I did the same steps on another Win 2k server and had the same results.  Without the modified DLL file, it wouldn't work.
 [2002-08-06 09:17 UTC] edink@php.net
The .dll problem part of this bug is solved in 4.2.2 release.
 [2002-08-10 12:22 UTC] cionci at tin dot it
PHP 4.2.2 works fine on Apache 2.0.39 as sapi module, but doesn't work on recently released 2.0.40.

"H:\Programmi\Apache Group\Apache2\bin\Apache.exe" -w -t -f "H:\Programmi\Apache Group\Apache2\conf\httpd.conf" -d "H:\Programmi\Apache Group\Apache2\." Syntax error on line 134 of H:/Programmi/Apache Group/Apache2/conf/httpd.conf:Cannot load H:/php/sapi/php4apache2.dll into server: Impossibile trovare il modulo specificato.

"Impossibile trovare il modulo specificato." in English means "Cannot find specified module"...

Do you have some suggestion ?

Thanks
 [2002-08-24 15:33 UTC] chris dot capel at free dot fr
Hi guys,
 [2002-08-24 15:33 UTC] chris dot capel at free dot fr
Hi guys,
 [2002-08-24 15:38 UTC] chris dot capel at free dot fr
Ooops...sorry for the 2 last e-mails...

Well I'm using WinXp, apache 2.40  and the php 4.2.2 and after changing the httpd.conf file with the three lines from the php install.txt, I couldn't restart apache. So i put only 2 lines like erik and change the php4apache2.dll with the 2 links given by christophe and db, but apache is still not restarting!!!
Please can you help me????
 [2002-08-28 04:18 UTC] luytent at yahoo dot com
Hello,

To get PHP 4.2.2 working with Apache 2.0.40 you need to download the developer release. I wanted to give you the url but I don't seem to find it for the moment.
There is only one problem when you use MySQL. And that's performance.
 [2002-08-28 04:22 UTC] luytent at yahoo dot com
I forgot to say that you only need to copy the php4apache2.dll to the sapi directory.
 [2002-09-04 11:09 UTC] McUsher at gmx dot de
Link to latest Builds:
WIN
http://snaps.php.net/win32/
LINUX
http://snaps.php.net/
 [2002-10-01 04:14 UTC] venek dot herynk at tiscali dot cz
Hi guys,

I have XP Pro, Apache 2.0.39, PHP 4.2.2 and I tried everything described above. It does not work for me. I am little bit crazy already.  Does anybody has the same problem?

Thanks
 [2002-10-02 14:11 UTC] james at deborched dot com
Yep, 

Same as above. nd It makes me nutts too. :(

good luck venek.herynk@tiscali.cz 

THe really annoying thing is, I had it working before on w2k. And now I cant get it working on either.
 [2002-10-06 11:58 UTC] king at soage dot com
hi venek.herynk

Same as above.

I have Win98 SE, Apache 2.0.43, PHP 4.2.3 and it does not work for me.

but it's working on XP now, i don't know what happend.
 [2002-10-08 18:05 UTC] sysop at lunatiq dot org
Wow, king@soage.com, that was JUST *soooo* incredibly HELPFUL!!!
 [2002-10-09 05:28 UTC] Jonathan_h at lycos dot de
Hi...
relieving to hear i'm not the onlyone with problems...
Anyway here is what happend to me...
I got apache 2.0.43 on XP with php 4.2.3
so after successfully confiuring...(had problems with the path (solved it by ../ instead of c:\etc.)
it still wouldn't work, saying "[...]\sapi_apache2.c is not compatable with this version of apache (found 20020628 need 20020903)"
Whoops i thought.. 
downgraded to apache 2.0.40 and wow it worked... until i tried some scripts of mine for extensive dataquerriing in a mysql db....
The scripts brought up errors i have never seen before, and apache on the host system suddenly used some 0.9 gigabytes of ram + some virtual (0.5gb)
momentarily i try the apache2 dll u recommended here...
just wanted to know if anyone got similiar results...
 [2002-10-09 05:35 UTC] Jonathan_h at lycos dot de
Just tried the php4apache2.dll from the link...
just doesn't work;
i get something like "Cannot load xx\xx\php4apache2.dll into server : The stated procedure was not found"
(translated)
anyone got an idea?
 [2002-10-09 11:26 UTC] ennio dot lepri at tiscali dot it
I'm also trying to configure the php module (php-4.2.3) with Apache 2.0.43 (on Windows 2K). I tried all the above hints but it didn't succeed...
 [2002-10-09 12:21 UTC] poopingjohn at hotmail dot com
From apache's release page: http://www.apache.org/dist/httpd/Announcement2.html

"All modules must be recompiled in order to work with this version [2.0.43]."
 [2002-10-12 18:38 UTC] macsrule_1 at hotmail dot com
My thanks go to the person at the top of this page. Your tip on getting PHP to work was invaluable. Thank you. It worked perfectly for me.
 [2002-10-18 15:49 UTC] none at none dot com
MAJOR problems with the development version of PHP (October 18th) and x86 Apache 4.0.43. I have tried on two seperate servers, and both have Apache crash when PHP and MySQL interact. I'm so tired.

If anyone else has this problem and knows a fix, please let me know. PHP developers, maybe there is a problem with php4apache2.dll?
 [2002-10-19 21:20 UTC] webmaster at jpcomm dot net
Ladie and Gentlemen, with all the troubles and hours spent, did you guys hit the pws-php4isapi.reg in the isapi folder? Before doing so I configured Apache 2.043, and PHP 4.2.3 downloaded at http://snaps.php.net/win32/php4-win32-latest.zip. I was convinced at first that the php4apache2.dll was corrupt and the server would not restart. Then with the server stopped I double-clicked the .reg file and the server restarted. Make sure you do follow all the proper steps in the most recent documentations. Hope this helps, I've spent hours upon hours before taking this silly step that is not documented. Oh by the way I'm running WINDOWS XP PRO.
 [2002-10-19 21:36 UTC] webmaster at jpcomm dot net
Darn. but i also did something really stupid: In addition to everything I made an extra copy of php4ts.dll and placed it in the root directory of Apache2 after I did that stupid .reg thing. It works! But I dunno if that will cause errors later on...
 [2002-10-23 08:35 UTC] none at none dot com
Well that is certainly frustrating.

Thanks for the fix. I already downgraded to Apache 1.3, and everything on my end is working.

PHP could certainly do with some good technical writing.
 [2002-10-23 20:52 UTC] blalond at umich dot edu
If you're getting 
"Cannot load C:/php4/sapi/php4apache2.dll into server: The specified module could not be found."
  or
"apache: module "c:\php4build\snap\sapi\apache2filter\sapi_apache2.c" is not compatible with this version of Apache (found 20020628, need 20020903)."

I got it working and this is everything I did:

1. Download:
 a. Apache: apache_2.0.43-win32-x86-no_ssl.msi
 b. PHP: php-4.2.3-Win32.zip
 c. Latest PHP Snap: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

2. Install
    a. apache
    b. PHP (by upzipping and renaming dir to "c:\php"
2. Copy c:\php\php.ini-recommended to c:\windows\php.ini
3. Edit c:\php.ini
    -doc_root = [current apache doc root]
    -extension_dir = C:\php\extensions
4. Copy c:\php\php4ts.dll to c:\winnt\system32\
4. Copy php4apache2.dll from the c. Snap zip file to c:\php\sapi\ 
6. Edit Apache's configuration file and add:
    LoadModule php4_module c:/php/sapi/php4apache2.dll 
    AddType application/x-httpd-php .php
 [2002-11-12 10:14 UTC] newstomail at yahoo dot de
In Addition:
While checking if PHP is working keep in mind clearing the browser cache! I thought my Apache2 server continues not work with PHP but the only thing was Mozilla keeping in mind the last access type of the URL...
 [2002-11-19 03:49 UTC] philip@php.net
index.txt has been updated to include Apache 2 related information and will show up in PHP 4.3.0.  Also, please read the following documentation online:

  http://www.php.net/manual/en/install.apache.php

The change to index.txt can be seen here:

http://cvs.php.net/diff.php/php4/win32/install.txt?r1=1.16&r2=1.17

This bug report is closed.  If you have support related questions on this issue please use the following location:

http://www.php.net/support

It's recommended to not use Apache 2 as PHP support for it is experimental.  Thank you for the report and helping make PHP better :-)
 [2002-12-16 20:08 UTC] 10 at email dot si
Thanks,  blalond@umich.edu,  your recipe also FIX this error: 

Event Type:	Error
Event Source:	Apache Service

The Apache service named  reported the following error:
>>> Cannot load D:/PHP4/sapi/php4apache2.dll into server: The specified procedure could not be found.     .

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
 [2002-12-20 19:21 UTC] m_m_mang at hotmail dot com
i had similar trubles on win2+sp3 apache 2.0.43 & php 4.xx(cause i tried a lot till it worked) 

however i found this version (PHP Version 4.3.0RC3)
from 
http://bugs.php.net/bug.php?id=17826
13 Dec 7:46am] vince@alkinos.com 
OK,

corrected thanks to Edin:

# There is link on the front page:
# 
# http://snaps.php.net/~edink/php-4.3.0RC3-Win32.zip
# 
# Edin

Vince
may god be  with them and i use the same 2lines as described on top of the page
(
LoadModule php4_module c:/php/sapi/php4apache2.dll
AddType application/x-httpd-php .php
)


and....
it?s working ....i can?t belive it !!!!


hope that will help ......
 [2003-01-06 19:46 UTC] browndude at hotmail dot com
okay guys.. guess what i almost tried everything up on this page, and finally something worked for me.

read the post "[23 Oct 2002 8:52pm] blalond@umich.edu" on this page.. very very very very helpful.  Thanks to the great guy who posted that heh.  I got Windows XP Apache 2.0.43 (apache_2.0.43-win32-x86-no_ssl.msi file), with Php 4.3.0 (php-4.3.0-Win32.zip file).  This is great stuff.. thanks alot to that dude again.. he did it for me.
 [2003-04-30 15:39 UTC] mike at yahoo dot com
I read every single post on this board and tried every suggestion and several desperate measures of my own.  Even tried the registry trick that was suggested on one of the posts by a fellow XP user.  No cigar.  None of the suggestions aided me in resolving the issue that leads to the error we are all trying to eliminate; "Cannot load c:\php\sapi\php4apache2.dll into server".  

I am running Windows XP, Apache 2.0.43 and Php 4.3.0.

Now, suppossedly php4apache.dll should NOT work with Apache 2.x.  That is what php4apache2.dll was written for.  Guess what, I tried it and it worked for me.  Is it working as it should?  That is another story.  I guess I'll find out soon enough.  

So, bottom line...do what the guy in the [October 23rd 2002 8:52 pm] post says if you have XP, and then try specifying the folowing in the Apache conf file...

LoadModule php4_module x:\php\sapi\php4apache.dll
AddType application/x-httpd-php .php .php3 .php4 .phtml

May or may not work for you.  To say this software is poorly documented and experimental is an understatement!

Cheers
 [2003-04-30 16:30 UTC] mike at yahoo dot com
Ok, I created a text file in my htdocs <dir> to see if Apache was recognizing .php files.  Called it phptest.php and inserted only the following... <? phpinfo(); ?>

This is what is specified on a page I used as my instruction set for installing PHP to integrate with Apache.   Here it is...  http://www.zdnet.com.au/builder/architect/sdi/story/0,2000035062,20273988,00.htm

No dice.  Did not work.

Next I copied the php4ts.dll file to the Apache/bin directory.  Still no go.  Finally added the line "AddModule mod_php4.c" to the AddModule section of the Apache http.conf file.    

Bingo!  I typed in the url http://<MyDnsName>/phptest.php and got it to bring up the page.  Seems like it is running now.

Good luck!
 [2003-04-30 16:32 UTC] alindeman@php.net
In future, don't ask support questions here -- http://php.net/support
 [2003-04-30 16:38 UTC] philip@php.net
Mike, the current docs mention all this, what's the problem?
 [2003-06-18 00:19 UTC] iswita_trivedi at hotmail dot com
hi! blalond ,

was rather hopeful that your tips would work . followed your instructions to the letter.

I'm working on Win 2000.Installed Apache +PHP as suggested by u, but on Starting the Server it shows the foll error:

System cannot find the file specified: No installed service named "Apache2".

Any tips will be welcome!!!!
 [2004-08-25 18:34 UTC] philip@php.net
To everyone viewing this bug report, this is NOT a support forum but instead go here:

  * http://www.php.net/support.php

Do not ask questions within this bug report, again, instead go here:

  * http://www.php.net/support.php

Questions within this bug report will NOT be answered, only frowned upon.  Documentation that should come in handy:

  How to Install PHP on Windows:
  * http://php.net/manual/en/install.windows.manual.php

  Apache 2 information for Winduws users:
  * http://php.net/manual/en/install.windows.apache2.php

  How to Install PHP on Linux:
  * http://php.net/manual/en/install.unix.php

  Apache 2 information for Linux users:
  * http://php.net/manual/en/install.unix.apache2.php

The "Tips" and "Instructions" found within this bug report are not supported by the PHP documentation team.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 23 09:01:28 2024 UTC