Re: win95/apache 1.3.14/and php 4.03
| From: | Andy Hoffman | Date: | Mon, 16 Oct 2000 14:11:36 +0000 |
| Subject: | Re: win95/apache 1.3.14/and php 4.03 | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3263@lists.php.net to get a copy of this message | ||
leffa Olausson wrote:
> short question??? why "run apache as module ..." ??
>
> I don't know too much about the diffrent installations you can have with php...
PHP under Apache can run either as a CGI executable or as a server module. There are several
differences between these two "modes" as I'll
call them. Here's an overview:
CGI vs. Module (seperated by --)
1 Execution) CGI runs as a standalone EXE that is loaded/run/unloaded everytime a php script is
requested -- Module runs as a DLL loaded by the
webserver, and remains in memory as long as the server is running, and when php scripts are
requested they are run by this memory resident
module - significantly speeding execution time.
2 Memory) Php scripts, under CGI, launch a single memory process for EVERY script run - with a large
site with lots of *hits*, this can
conceivably eat up all available memory -- Under Apache Module, memory is allocated and more tightly
managed by the module, keeping runnings
scripts in check, so to speak, better preventing loss of all available memory and crashing the
server.
Now, the bonuses (or perceived bonuses :)) of running as a server module also have a downside. The
biggest is that, as a memory resident
module, the script parser in module mode is more susceptible to memory corruption. If a script
running under CGI mode fails (or does something
BAD, like GPF or other illegal memory access), it will simply die in the current process, and the
system can easily kill that process and have
a good chance of recovery without fatal error. But, in module mode, this bad script/GPF/etc. not
only can effect the current script process,
but also ALL other processes running under the module, and the module DLL itself. When the CGI
fails, the single process dies but subsequent
scripts may still work... but when the module fails, it may take the web server down with it, and in
any event subsequent scripts may not run
until the web server is restarted (and the module reloaded).
Another downside of running under module mode is simply lack of robust testing... Not to say that
the module isn't being run and tested, simply
a matter of statistics... When you have a programming environment (like PHP) which is developed
primary for Unix systems, the Windows
environment doesn't see as much action (less testing)... Add to that the fact that most users
of Windows PHP run in CGI mode, as opposed to
server api modules, either Apache module or ISAPI (IIS) or NSAPI (Netscape servers), and you see
that the amount of people running in a server
api (termed SAPI) module mode is a VERY SMALL percentage of the total PHP population (I say around
1-2% conservatively)
Now, the more people run in SAPI mode on Windows systems, the more testing goes on, and the more
stable the code becomes... just depends on
your point of view. So I say, if you can run in SAPI mode on your server, please do! The more the
merrier (since the stabler the code
becomes, the happier we all will be).
Hope that helps to give an overview (though long-winded) of what "running as a module"
means.
> I have a win95/apache 1.3.14/and php 4.03... that dosn't work. I changed it from a php
> 4.02 version that worked, but not now any longer !!!
First, just an advisory note... whenever upgrading either php OR apache from versions that work on
your machine, to newer versions... it's
recommended that you make copies of your configuration files for later reference... Personally, when
I install a new version of PHP, I install
to a new directory (named similar to "c:\php402" or "c:\php403" and the same
for Apache) and then make the necessary modifications to fresh
copies of my configuarion files (in this case php.ini and httpd.conf) to reference the new
directories... that way I can easily back up to my
previously installed environment if anything goes wrong.
Now, to your problem, what specifically "doesn't work"? Are you getting NO response
from the web server, or only from php scripts? Do your
php scripts just sit there and not respond to the browser, or are you getting an Apache error
message? When you switched to php4.0.3, what
changes did you make to your httpd.conf (see below)? Were you sure to replace existing copies of
php4ts.dll in your windows directory with the
new php4ts.dll for php4.0.3?
> what param. to add or change in apache 1.3.14 httpd.conf ? what param. to add or change in php
> 4.03 php.ini ?
I'm making the following 3 assumptions (you'll need to modify your files according to your
own installation directories):
1. Apache installed in C:\Program Files\Apache (with conf, bin, and other directories below this
main Apache root dir)
2. PHP (version 4.0.3 downloaded from www.php4win.de) installed in C:\php403 (with extensions, sapi,
and other dirs below this directory)
3. Apache document root is C:\docroot (though the document root is not that important to this
discussion).
If running under Apache as CGI mode, you need the following 3 lines in your httpd.conf:
ScriptAlias /php/ "c:/php403/"
Action application/x-httpd-php "/php/php.exe"
AddType application/x-httpd-php .php .php3 .php4
If running under Apache module mode, you need these lines in your httpd.conf:
ScriptAlias /php/ "c:/php403/"
LoadModule php4_module "/php/sapi/php4apache.dll"
AddType application/x-httpd-php .php .php3 .php4
In your php.ini file, it's best to comment out ALL extensions before trying a new version of
php... that way you can make sure Apache and PHP
are communicating correctly without any extension issues getting in the way... once you have PHP and
Apache running together, you can then
re-add your extensions to see if/where problems are occurring. So, in your php.ini, the ONLY things
you might need to change would be
directory settings which reference the installed directory structure. Double-check any directory
references (such as "extension_dir" to make
sure they are pointing to the right locations).
After you've check all that, what do you get?
--
Andy Hoffman
Web Developer
Bristol-Myers Squibb
email: andy.hoffman@bms.com