Click to See Complete Forum and Search --> : PHP Efficiency


cweathers74
01-27-2006, 03:08 AM
Regular Perl for CGI has the problem of each request spawning a new Perl process.

Does PHP have this issue?

SpectreReturns
01-27-2006, 01:09 PM
'Fraid so, as far as I know.

chazzy
01-27-2006, 01:11 PM
I think sessions would keep up a persistent process.

bokeh
01-27-2006, 01:22 PM
I think sessions would keep up a persistent process.Not so! When a script that called session_start() closes, the session array is stored to file. If you are using a shared server that information is available to everyone for as long as the session persists.

chazzy
01-27-2006, 01:50 PM
Not so! When a script that called session_start() closes, the session array is stored to file. If you are using a shared server that information is available to everyone for as long as the session persists.

Hmmm..
But then how does it know to pull up the same previous session?

bokeh
01-27-2006, 02:01 PM
The session files are named thus:sess_ce5dc2b323397d917dae0cc644a7f28e (no extension). When a script calls session_start() a check is made to see if the client sent a session cookie; if yes the filename the corresponds to the session id in the session cookie is opened. If there was no session cookie set on the client a new session file is created with it's own unique file name. This files are saved in /.../.../php/session

NogDog
01-27-2006, 07:45 PM
Regular Perl for CGI has the problem of each request spawning a new Perl process.

Does PHP have this issue?
I believe (but was unable to confirm after a few minutes of web searching) that the typical SAPI webserver installation of PHP is similar to the mod_perl version of Perl, in that a single PHP process is launched by the webserver when it starts up. If you opt for the CGI installation of PHP, then it's like the non-mod_perl CGI installation of Perl, having to spawn the parser/compiler process for each request.