NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
problems with loading php5 apache2 dll *solved*


Joined: 14 Jul 2004
Posts: 6
Reply with quote
I'm seeing the following message when attempting a LoadModule on php5apache2.dll

httpd.exe: Syntax error on line 119 of C:/Program Files/Apache2/conf/httpd.conf:
API module structure 'php5_module' in file C:/Program Files/nusphere/phped/php5/
php5apache2.dll is garbled - perhaps this is not an Apache module DSO?

Load module looks like this:

LoadModule php5_module "C:/Program Files/nusphere/phped/php5/php5apache2.dll"

I keep thinking this has to be something simple. Have tried:

replacing php5apache2.dll with a version downloaded from the php site
using dos format PROGRA~1 in case spaces were causing a problem
moving the dll to the apache modules directory

It is clear that the dll is being found by Apache but regarless of what I do it is always considered to be 'garbled'. The same holds true for php4apache2.dll in a PHP4 configuration.

Suggestions?
View user's profileFind all posts by cgossSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
I'm not sure what apache and php distributions you use and why it is all posted in this forum Smile
If you need Apache2 + php4, just take a look at NuSphere Techplatform 4.4.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Jul 2004
Posts: 6
Reply with quote
I'm using standard Apache 2.20 which is already installed and configured on my WinXP system. It didn't stike me as odd to think that rather than replacing my current installation (which provides web support for other non-php development projects) I could point Apache2 at the Nusphere PhpEd 4.5 php5 installation I purchased last week ... and expect the dlls to load.
View user's profileFind all posts by cgossSend private message


Joined: 14 Jul 2004
Posts: 6
Reply with quote
What I hoped to find out by posting was whether anyone was familiar with this error. When an initial set of web searches didn't turn up a clear explanation on the web I decided to try this forum thinking that I might find someone who was familiar with it. I never meant to suggest that NuSphere's PHP distribution was worse or different from that of the official distribution. As for dll replacement, when the original php5apache2.dll didn't load I replaced it with the one shipped with PHP to see if there was any difference in behavior. There wasn't so I returned to the NuSphere dlls.

I have run PHP4 with Apache2 in the past (pre NuShpere) both as a binary (via ScriptAlias) and as via LoadModule. I haven't run PHP5 which I'm only now switching to because of its improved MySQL connection support. What is interesting is that after installing NuSphere PHP I am no longer able to use LoadModule with Apache2. Both php4apache2.dll (if configuring for php4) and php5apache2.dll (for php5) fail with the 'garbled' error I reported at the beginning of this thread.

Please understand that I'm not pointing fingers at NuSphere but I am wondering what changed. I can and will return to using a PHP binary if I have to but in the meantime I'd like to try to understand why a common load methodolgy like this is failing.
View user's profileFind all posts by cgossSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Quote:
I could point Apache2 at the Nusphere PhpEd 4.5 php5 installation I purchased last week ... and expect the dlls to load.

Actually, you're wrong here Smile
not because phped has anything wrong, it's just Windows dll loading scheme.
For Apache's process current directory is where httpd.exe (apache.exe) is.
Windows first tries to load dll from System32, then from the process current directory, then from directories listed in the PATH.
You might wonder at this point why it couldn't load php5apache2.dll you pointed directly. The correct answer is that even though you supplied path to php5apache2.dll and it's there, Windows can not find php5ts.dll that php5apache2.dll uses.
Similarly it won't load for example php_mysql.dll because this dll is in extensions dir while libmysql.dll it's linked with is in the upper directory and that's why libmysql.dll won't be found until this upper directory is the process's current directory or listed in the PATH.

To get it working you have to either
a) copy all the dlls into Apache bin directory
or
b) add path to php5 and php5\extensions to windows PATH list and reboot computer.
Don't forget that normally Apache runs under LOCAL SYSTEM account and therefore you should update PATH for SYSTEM, not for current user Smile

Quote:
dos format PROGRA~1 in case

never use it Smile just surround library file name with quotes Smile, for example "C:\program files\apache group\apache\modules\php5apache2.dll"
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Jul 2004
Posts: 6
Reply with quote
Hmm. Thanks for the thoughtful answer but I'm not sure you're correct.

// Path output trimmed for clarity
PATH=C:\Program Files\nusphere\phped\php5\

// dll listing trimmed for clarity
C:\Program Files\nusphere\phped\php5>dir *.dll
Volume in drive C has no label.
Volume Serial Number is 44E7-4079

Directory of C:\Program Files\nusphere\phped\php5

01/11/2006 05:15 PM 1,069,056 libmysql.dll
02/06/2006 07:47 PM 53,319 php5activescript.dll
01/11/2006 05:14 PM 36,924 php5apache.dll
01/11/2006 05:14 PM 36,925 php5apache2.dll
01/11/2006 05:14 PM 53,314 php5apache_hooks.dll
01/11/2006 05:14 PM 28,731 php5isapi.dll
01/11/2006 05:14 PM 28,731 php5nsapi.dll
01/11/2006 05:14 PM 4,411,448 php5ts.dll

// Load module directive in httpd.conf
LoadModule php5_module "C:/Program Files/nusphere/phped/php5/php5apache2.dll"

// Apache2 httpd finds php5_module because of direct reference in httpd.conf
$ httpd -S
httpd.exe: Syntax error on line 119 of C:/Program Files/Apache2/conf/httpd.conf: API module structure `php5_module' in file C:/Program Files/nusphere/phped/php5/php5apache2.dll is garbled - perhaps this is not an Apache module DSO?

// Test moving to bin as you suggest
$ cp php5apache2.dll "C:/Program Files/Apache2/bin"

// Adjusted LoadModule in httpd.conf
LoadModule php5_module php5apache2.dll

// Apache2 httpd can't find the dll in bin
$ httpd -S
httpd.exe: Syntax error on line 119 of C:/Program Files/Apache2/conf/httpd.conf: Cannot load C:/Program Files/Apache2/php5apache2.dll into server: The specified module could not be found.

// Move dll to Apache2 dir
$ mv "C:/Program Files/Apache2/bin/php5apache2.dll" "C:/Program Files/Apache2"

// Apache2 httpd finds the dll but still 'garbled'
$ httpd -S
httpd.exe: Syntax error on line 119 of C:/Program Files/Apache2/conf/httpd.conf: API module structure `php5_module' in file C:/Program Files/Apache2/php5apache2.dll is garbled - perhaps this is not an Apache module DSO?

PS. My tests with dos format PROGRA~1 were just to see if the bahavior differed. It didn't so I switched back to quotes.
View user's profileFind all posts by cgossSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
you can not check PATH this way.
Apache runs before you log in and its PATH is taken from the SYSTEM PATH, not user's PATH variable.
Please double check SYSTEM environment variable:
Right click on My Computer, Advanced tab, Environment Variables button, System Variables list (on the bottom).


Oh, just got it. You're using 2.2, not 2.0 Smile
Sorry for misleading Smile

Quote:
Apache 2.2 add-in modules are not compatible with Apache 2.0

^^^^^^^ it's from Apache web site (http://httpd.apache.org/download.cgi )
Php5 that comes with phped is 100% win32 distro created by PHP Group. We did not change the binaries.
If you need php debugger and have php already installed, just add php_dbg.dll module according to instructions on FAQ forum.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Jul 2004
Posts: 6
Reply with quote
Now I'll say 'solved'.

It’s a drag that I missed the Apache warning about the 2.0/2.2 add-in incompatibilities.

No doubt there will eventually be 2.2 compatible dlls distributed with PHP. In the meantime there are two solutions to the ‘garbled’ problem:

1. Roll back to Apache to 2.0

2. Install Apache 2.2 compatible dlls available at

Thanks Dmitri for the persistence and the sharp eyes.
View user's profileFind all posts by cgossSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
they (I mean apache group) could implement module loader more user-friendly... At least they could put version number first in the DSO struct and check it first after module is loaded, then make decision if version is not compatible and warn about it, not misleading "garbled".

regarding 2.2, it's still possible to run php as CGI module and it will work good I think.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Jul 2004
Posts: 6
Reply with quote
Yes, I'm sure you're right about the CGI modules and you probably won't be surprised to hear that I'll second (and third) your suggestion that they provide an improved naming convention and error messages.

For what its worth I have been running the Apache Lounge dlls (see my last post) with 2.2 for the last hour and all is well.

Thanks again!
View user's profileFind all posts by cgossSend private message
problems with loading php5 apache2 dll *solved*
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic