Customize for PHP?
Moderator: General Moderators
-
David_Irving
- Forum Newbie
- Posts: 8
- Joined: Wed Jun 28, 2006 2:55 am
Customize for PHP?
How do i customize my (own made) website for using the php engine? I've been running off Apache for quite some time but being a software developer i just couldn't resist. Is there a detailed guide on how to do this?
Thankyou,
David.
Thankyou,
David.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
-
David_Irving
- Forum Newbie
- Posts: 8
- Joined: Wed Jun 28, 2006 2:55 am
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
-
David_Irving
- Forum Newbie
- Posts: 8
- Joined: Wed Jun 28, 2006 2:55 am
So would that work like parameters? Say i execute php.exe (say having "C:/phpscripts/test.php" for parameter one) what would happen next? It would just compile it? Wheres the output?Jixxor wrote:I believe Apache just invokes the php.exe file whenever it encounters a PHP file or code.
So a simple file path and code for your web server that directs it to use the php.exe everytime it encounters a PHP file or code to render it would work?
It's been a while since I've gone exploring into the web server arena, especially that of Apache. When installing PHP on a machine also housing Apache, one just simply had to add/edit a few lines in Apache's httpd.conf file that would provide Apache with the path to the PHP.exe file and included some other directives (can't recall exactly). Apache can also run PHP as a module through the php4apache.dll (or php5apache,dll) file using the text:David_Irving wrote:So would that work like parameters? Say i execute php.exe (say having "C:/phpscripts/test.php" for parameter one) what would happen next? It would just compile it? Wheres the output?Jixxor wrote:I believe Apache just invokes the php.exe file whenever it encounters a PHP file or code.
So a simple file path and code for your web server that directs it to use the php.exe everytime it encounters a PHP file or code to render it would work?
Code: Select all
LoadModule php4_module "c:/php/php4apache.dll" // Load php4 as a module for ApachePerhaps you can use this information to further study how Apache uses the PHP engine? I've always understood things by tearing them apart, see how they work, and then putting them back together... it might work for you too.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
PHP I blieve can be executed 2 ways:David_Irving wrote:So would that work like parameters? Say i execute php.exe (say having "C:/phpscripts/test.php" for parameter one) what would happen next? It would just compile it? Wheres the output?Jixxor wrote:I believe Apache just invokes the php.exe file whenever it encounters a PHP file or code.
So a simple file path and code for your web server that directs it to use the php.exe everytime it encounters a PHP file or code to render it would work?
1) CGI
2) CLI
As a CGI module, PHP is run as a thread/process inside Apache...under Windows anyways...or is what I remember anyways...
This means...PHP is only ever loaded once, when Apache is first fired up...and it stays resident in memory until Apache or the system is restarted...
This saves you the cost and overhead of re-loading an application and leads to better performance...
CLI (Command line interface) is the example you have given...
This has the disadvantage of shutting down everytime the script completes and starting back up every times you call a script...
The output is sent to STDOUT so your web server would have to capture that and forward the output appropriately...
Actually, when PHP is executed as CGI... For every request that involves PHP processing, a PHP instance (CLI) is spawned.. And then the environment variables are filled by the webserver... Which PHP can happily use... This spawning of all these instances doesn't scale very well... (More info on the Common Gateway Interface: http://www.w3.org/CGI/)
To improve this, most webservers apache (via modules) and iis (via isapi) load a couple of these instances in memory... And reuses these... This increases performance drastically... (More info on apache: http://httpd.apache.org/docs/2.0/developer/)
I presume you'll probably start with an implementation of CGI in your webserver... And if you're really into a challenge, build a concept that allows the user to have a pool with instances of whatever interpreter/request-handlers....
To improve this, most webservers apache (via modules) and iis (via isapi) load a couple of these instances in memory... And reuses these... This increases performance drastically... (More info on apache: http://httpd.apache.org/docs/2.0/developer/)
I presume you'll probably start with an implementation of CGI in your webserver... And if you're really into a challenge, build a concept that allows the user to have a pool with instances of whatever interpreter/request-handlers....
-
David_Irving
- Forum Newbie
- Posts: 8
- Joined: Wed Jun 28, 2006 2:55 am
-
David_Irving
- Forum Newbie
- Posts: 8
- Joined: Wed Jun 28, 2006 2:55 am