Re: [newbie] Small question about FastCGI [message #179415 is a reply to message #179412] |
Wed, 24 October 2012 05:06 |
Michael Vilain
Messages: 88 Registered: September 2010
Karma:
|
Member |
|
|
In article <0suc885dhh0buidnju0h77oqejlb8q22pa(at)4ax(dot)com>,
Gilles <nospam(at)nospam(dot)com> wrote:
> Hello
>
> I just installed Lighttpd and mod_fastcgi to improve performance when
> running PHP scripts over CGI.
>
> Am I correct in understanding the following about what mod_fastcgi
> does:
> 1. loads severals instances of the PHP interpreter, each in its own
> process (hence the numerous instances of /usr/bin/php5-cgi in "ps aux"
> and the "php.socket-" pseudo-files in /tmp)
> 2. translates between HTTP requests/responses and the PHP scripts
> 3. does nothing about the PHP scripts, which are loaded, parsed,
> compiled, ran, and unloaded every time they are called
> ?
>
> I'm especially concerned about the last point: If I make a lot of
> calls to the database, does it mean that FastCGI doesn't provide
> persistent connections to it, so I'll have to investigate other ways
> to avoid opening/closing DB connections every time? Or is
> opening/closing DB connections a non-issue and the main issue is
> actual commands sent to the DB?
>
> Thank you.
According to http://php.net/manual/en/function.mysql-pconnect.php you
can only do persistent connections with mod_php. This is because the
apache server stays around and can reuse the mysql connection. With
FastCGI, this doesn't happen. Apache forks php5-cgi which dies after
the script is completed.
Rethink your requirement for persistent database connections or use
mod_php instead of FastCGI.
--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]
|
|
|