RE: [PHP] php .vs cgi app..

2004-07-14 Thread Vail, Warren
This is one of those questions that will get lot's of different answers
depending on your responders perspective.  This is my view;

PHP can be executed as a CGI or as a MOD by Apache (or most web servers).
This means that Apache can load a fresh copy of PHP with each browser
request to the server (CGI), or it can load PHP on startup, or first request
(MOD) and can continue to use that version for each subsequent browser
request to the server (on .php files only, of course).  Interestingly
enough, I believe Perl can be executed by Apache in either fashion as well.

Apache gets config parameters, when PHP is available, that tells it where to
find the PHP modules, and will load them from there in either case.  The
server also has a Base Directory where it expects to find it's
html/php/perl/etc documents and will make sure the appropriate interpreter
is used based on the document file type.  There was a time when the first
line of the script (beginning with a splash/bang; i.e. #!/usr/local/bin/perl
) determined the interpreter, and this may still be available in Apache.  It
should still be possible to even write C programs and execute the compiled
binary as a CGI, which means in this case no interpreter is required and
form input is read from stdin and html is sent to the browser via stdout (if
you are familiar with C).  While C may produce the fastest code, you should
find PHP is much more suited for developing web applications than almost any
other option.

Just to add to the confusion, PHP can be executed from the command line of a
telnet session, or more commonly by a cron timer program, which I have
also heard referred to as running PHP as a cgi.  The syntax for that is;

/path/to/php /path/to/php/script.php

Hope this helps a bit,

Warren Vail
 


-Original Message-
From: bruce [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 14, 2004 10:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP] php .vs cgi app..


hi..

a really general/basic question... what is the difference between a cgi
app and a php app.. does it really come down to where the app is being run
from..

i mean within apache, if i specify that php/perl/etc... app resides at a
given location, and that files with a certain extension are to be handled by
the perl/php/etc app, then i can handle the processing of the file by the
interpreter anywhere within my site that i grant access to. is there
anything/any reason to have a cgi-bin portion of my app, other than good
design practice...

clarification would be useful!!!

thanks..

-bruce

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php .vs cgi app..

2004-07-14 Thread Ciprian Constantinescu
As I know, if you run PHP as a module for Apache is faster than running
as CGI. Also Python scripts can be run as a module(faster) or as CGI. The
main disadvantage for Python as a module is that you don't get all the
facilities of CGI.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php