1993–1996: Perl CGI Execution Model
Common Gateway Interface (CGI) treat web scripts as standalone shell executables. For every single incoming TCP hit, the web server (NCSA httpd, early Apache) calls fork() and execve('/usr/bin/perl').
# Apache httpd.conf:
ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
# Incoming hit triggers:
# 1. clone() process ID
# 2. Kernel context switch (15-80ms penalty)
# 3. Load entire /usr/bin/perl binary + CPAN modules into RAM
# 4. Parse script, emit Content-type header, exit & teardown
1998+: The Apache mod_php Revolution
Rasmus Lerdorf & the Zend engine embedded the PHP interpreter directly inside Apache child processes. Workers are pre-forked at boot time, remaining in RAM ready to immediately run code embedded inside standard <?php ... ?> HTML tags without spawning OS processes.
# Apache httpd.conf:
LoadModule php5_module libexec/libphp5.so
AddType application/x-httpd-php .php
# Incoming hit triggers:
# 1. Zero process forks: worker thread/child accepts connection
# 2. PHP opcode executes directly in-memory (0ms execve delay)
# 3. Persistent MySQL connection pool reused
# 4. Immediate connection close without OS teardown overhead