|
Posted by Mladen Gogala on 06/05/05 07:34
On Sat, 04 Jun 2005 23:49:46 +0000, Keith wrote:
> All:
> What is the difference between Perl (CGI) and PHP (Apache module)? I thought both used servers to direct the
> user to the appropiate Perl or PHP program in order to execute the program to interpret the user's Perl or PHP script
> respectively.
>
> Keith
Generally speaking, difference between CGI script and an interpreter
module is that CGI script will spawn a new process and page in the invoked
interpreter, be it Perl, PHP or some kind of shell, while module will
execute in the context of httpd process itself. The price for that is
growth of the httpd process itself, but context switches are avoided as
well as the costly interprocess communication. Furthermore, process
creation is an expensive operation which requires a lock on the kernel
process table which further reduces concurrency. It is not as expensive as
$CREPRC system service used to be on VMS, but it's still significantly
more expensive then executing the interpreter within the context of an
existing process. Here is what PHP5 interpreter linked as an Apache module
looks like on FC3:
# pmap 3519
3519: /opt/apache/bin/httpd -k start
003b8000 20K r-x-- /lib/libcrypt-2.3.5.so
003bd000 4K r-x-- /lib/libcrypt-2.3.5.so
003be000 4K rwx-- /lib/libcrypt-2.3.5.so
003bf000 156K rwx-- [ anon ]
004d4000 912K r-x-- /usr/lib/libxml2.so.2.6.16
005b8000 36K rwx-- /usr/lib/libxml2.so.2.6.16
005c1000 32K rwx-- [ anon ]
005cb000 32K r-x-- /lib/tls/librt-2.3.5.so
005d3000 4K r-x-- /lib/tls/librt-2.3.5.so
005d4000 4K rwx-- /lib/tls/librt-2.3.5.so
005d5000 40K rwx-- [ anon ]
005ee000 84K r-x-- /lib/ld-2.3.5.so
00604000 4K r-x-- /lib/ld-2.3.5.so
00605000 4K rwx-- /lib/ld-2.3.5.so
00608000 20K r-x-- /usr/lib/libgdbm.so.2.0.0
0060d000 4K rwx-- /usr/lib/libgdbm.so.2.0.0
0062d000 8K r-x-- /lib/libdl-2.3.5.so
0062f000 4K r-x-- /lib/libdl-2.3.5.so
00630000 4K rwx-- /lib/libdl-2.3.5.so
006fc000 64K r-x-- /usr/lib/libz.so.1.2.2.2
0070c000 4K rwx-- /usr/lib/libz.so.1.2.2.2
00723000 1164K r-x-- /lib/tls/libc-2.3.5.so
00846000 4K --x-- /lib/tls/libc-2.3.5.so
00847000 8K r-x-- /lib/tls/libc-2.3.5.so
00849000 8K rwx-- /lib/tls/libc-2.3.5.so
0084b000 8K rwx-- [ anon ]
0084f000 56K r-x-- /lib/tls/libpthread-2.3.5.so
0085d000 4K r-x-- /lib/tls/libpthread-2.3.5.so
0085e000 4K rwx-- /lib/tls/libpthread-2.3.5.so
0085f000 8K rwx-- [ anon ]
008f0000 116K r-x-- /usr/lib/libexpat.so.0.5.0
0090d000 8K rwx-- /usr/lib/libexpat.so.0.5.0
009eb000 60K r-x-- /lib/libresolv-2.3.5.so
009fa000 4K --x-- /lib/libresolv-2.3.5.so
009fb000 4K r-x-- /lib/libresolv-2.3.5.so
009fc000 4K rwx-- /lib/libresolv-2.3.5.so
009fd000 8K rwx-- [ anon ]
00c6c000 136K r-x-- /usr/lib/libpng12.so.0.1.2.8
00c8e000 4K rwx-- /usr/lib/libpng12.so.0.1.2.8
07e7d000 72K r-x-- /lib/libnsl-2.3.5.so
07e8f000 4K r-x-- /lib/libnsl-2.3.5.so
07e90000 4K rwx-- /lib/libnsl-2.3.5.so
07e91000 8K rwx-- [ anon ]
08048000 388K r-x-- /opt/apache/bin/httpd
080a9000 12K rwx-- /opt/apache/bin/httpd
080ac000 1476K rwx-- [ anon ]
b6c79000 56K rwxs- /dev/zero (deleted)
b6c87000 516K rwx-- [ anon ]
b6d08000 4K r-x-- /usr/lib/locale/locale-archive
b6d09000 24K r-x-- /usr/lib/locale/locale-archive
b6d0f000 180K r-x-- /usr/lib/locale/locale-archive
b6d3c000 2048K r-x-- /usr/lib/locale/locale-archive
b6f3c000 36K r-x-- /lib/libnss_files-2.3.5.so
b6f45000 4K r-x-- /lib/libnss_files-2.3.5.so
b6f46000 4K rwx-- /lib/libnss_files-2.3.5.so
b6f47000 1464K r-x-- /oracle/product/10g/lib/libnnz10.so
b70b5000 144K rwx-- /oracle/product/10g/lib/libnnz10.so
b70d9000 4K rwx-- [ anon ]
b70da000 10772K r-x-- /oracle/product/10g/lib/libclntsh.so.10.1
b7b5f000 1048K rwx-- /oracle/product/10g/lib/libclntsh.so.10.1
b7c65000 84K rwx-- [ anon ]
b7c95000 1912K r-x-- /opt/apache/modules/libphp5.so
b7e73000 196K rwx-- /opt/apache/modules/libphp5.so
b7ea4000 116K rwx-- [ anon ]
b7ec1000 132K r-x-- /lib/tls/libm-2.3.5.so
b7ee2000 4K r-x-- /lib/tls/libm-2.3.5.so
b7ee3000 4K rwx-- /lib/tls/libm-2.3.5.so
b7eff000 112K r-x-- /opt/apache/lib/libapr-0.so.0.9.6
b7f1b000 4K rwx-- /opt/apache/lib/libapr-0.so.0.9.6
b7f1c000 4K rwx-- [ anon ]
b7f1d000 816K r-x-- /lib/tls/i686/libdb-4.2.so
b7fe9000 8K rwx-- /lib/tls/i686/libdb-4.2.so
b7feb000 4K rwx-- [ anon ]
b7fec000 76K r-x-- /opt/apache/lib/libaprutil-0.so.0.9.6
b7fff000 4K rwx-- /opt/apache/lib/libaprutil-0.so.0.9.6
bffeb000 84K rwx-- [ stack ]
ffffe000 4K ----- [ anon ]
total 24884K
#
The PHP5 module is linked as a shared library, named
"/opt/apache/modules/libphp5.so". You can also link perl
as an Apache module. The mod_perl module can be downloaded
both from the Apache home and CPAN.
--
Demagogue: One who preaches a doctrine he knows to be untrue to
men he knows to be idiots.
H.L. Mencken
Navigation:
[Reply to this message]
|