Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WinXP Pro SP1 / Apache 2.0.50 / PHP 4.3.8

Status
Not open for further replies.

Peahippo

MIS
Jul 18, 2003
91
0
0
US
I can't get PHP to respond to <? or <?php commands on this system.

The Windows is stable and on a corp intranet. I thought I'd try an internal webpage with scripting capabilities for distributing support files. I didn't want to go back into that pile of blistering hell known as IIS and ASP [red](shudder)[/red], so I thought I'd give PHP a try.

I obtained the latest Apache for Win32 and installed it. It works as expected by default. My httpd.conf modifications were minimal.

I went to and noted that installing PHP would be a little tricky, what with all the disclaimers. It was especially worrying that both PHP 4 and 5 claimed that working with Apache 2 was "experimental".

At first I tried the latest PHP 5, and in order to avoid the CGI version, I did a manual install by following install.txt from the Win32 zip download. I wanted to load it as an Apache module. I made my php.ini modifications and plopped it into C:\Windows; plopped the minimum 2 DLLs (php4ts.dll and php4apache2.dll) into C:\Windows\System32; then added to Apache's httpd.conf:

[blue][tt]#
# PHP 5 settings
#
LoadModule php5_module c:\windows\system32\php5apache2.dll
AddType application/x-httpd-php .php[/tt][/blue]

The Apache monitor saw PHP as a module, but this code:

[blue][tt]<BR>
<?php phpinfo(); ?>
<BR>
<?php
echo "Hello World";
?>[/tt][/blue]

... generated nothing.

I removed PHP 5 and installed PHP 4 essentially the same from the install.txt instructions, but obtained the same results.

I can run "php.exe -i" and see that it runs fine. [green]But why doesn't Apache run it as a server module?[/green]
 
Perhaps this line in the httpd.conf?

AddModule mod_php4.c (or 5)

I can't remember exactly how it all goes off hand, but the three httpd.conf lines need to be in a certain order as well... but your apache startup would kick an error if that were the problem.

 
Very dumb question:
Did you restart Apache after the changes?
 
The AddModule command was rejected by Apache. Once removed, Apache loads without a problem. The PHP install.txt mentioned that that might occur with Apache 2, hence this seems OK.

I always stopped Apache before making httpd.conf changes, then restarted it afterwards.
 
I think what seems ok may be your problem... look and see if you have a line in your httpd.conf which reads ClearModuleList (which should be AFTER your LoadModule directive) If so I'm fairly certain you need the AddModule line to follow it.

Maybe not though, I gave up on Apache 2.x a long time ago, best of luck.

 
There is no ClearModuleList in my httpd.conf. I also checked in httpd.default.conf; again, no ClearModuleList.

According to this command can be issued to clear all the loaded modules, and then you can load fresh from AddModule and LoadModule.

The AddModule ref says you are simply loading them. It also mentions load order may be relevant, but I put the PHP lines at the end of httpd.conf.

I just now tried putting the PHP lines a the beginning of httpd.conf. No change.

I moved the lines back to the end, then put ClearModuleList at the beginning. That generated a syntax error. It's bizarre, but my Apache 2 doesn't recognize ClearModuleList or AddModule as valid commands.

What the heck's going on here?
 
The AddModule directive is not supported by Apache 2.0.

With Apache 1.3, one had to issue both AddModule and LoadModule commands to install a module. Apache 2.0 only uses LoadModule.

I believe ClearModuleList was dropped at the same time as AddModule

My Apache 2.0 installation (admittedly on Linux, but the command should be similar -- the paths will differ) only requires 2 directives to make PHP work as a module:

LoadModule php4_module lib/apache/libphp4.so
AddType application/x-httpd-php .php




Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I can then only conclude that these httpd.conf lines:

[blue][tt]LoadModule php5_module c:\windows\system32\php5apache2.dll
AddType application/x-httpd-php .php[/tt][/blue]

... are correct for PHP 5. But PHP 4 and 5 still don't respond to [red]<?[/red] or [red]<?php[/red] calls. How do I find out in Apache if the calls are actually getting through to PHP? Do I resort to the [green]strace[/green] method outlined in PHP's install.txt?
 
Apache's [green]error.log[/green] shows sequences of notices very much like this:

[blue][tt]Parent: Child process exited successfully.
Parent: Created child process 3844
Child 3844: Child process is running
Child 3844: Acquired the start mutex.
Child 3844: Starting 250 worker threads.
Parent: Received shutdown signal -- Shutting down the server.[/tt][/blue]

... which I conclude is normal.

I will try strace.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top