how php works with apache

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
zia
Forum Newbie
Posts: 9
Joined: Fri Jan 03, 2003 3:51 am

how php works with apache

Post by zia »

I have just registered and this is my first topic. I have been able to install php on Windows 2000 and to connect it with Oracle 9i database via Oracle HTTP server powered by apache. But it is not clear to me what is going on behind the scene? How php and apache is working? If someone can give me a clear picture of the technology.

Thank you all on this forum
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

my best guess is researching on http://www.oracle.com
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

the webserver gets an HTTP request. The header contains the path to the requested document (e.g. access.log: xxx.xxx.xxx.xx - - [23/Dec/2002:15:31:23 +0100] "GET /index.php HTTP/1.1" 200 1634. If the server finds an appropriate document (e.g. /usr/local/htdocs/test.php) it tries to handle it.
Your httpd.conf might contain something like AddType application/x-httpd-php .php associating files having the extension .php with the mime-type application/x-httpd-php.
Via AddModule mod_php4.c the php-module was loaded and it told apache that it will handle documents of the mime-type */x-httpd-php.
So, if a document like /index.php has been requested apache will call the php-module and advise it to execute the script.
The php-module 'knows' how to retrieve server/request-data like in $_SERVER, $_GET, ... (or where and how apache stored it) and how to deliver the datastream that is to be sent back to the requester.
Post Reply