php under FastCGI

Problem: If you need to run regular php scripts under FastCGI, saving
on the overhead of fopen'ing and reading in the contents before
executing each time, in theory I guess you'd put a FastCgiServer
directive in your httpd.conf, and direct it to some sort of app (could
be written in C or anything) that loads and keeps in memory all your
php files from your site, and runs their contents when a url request
comes in for that file. Does such an app exist?
drblitzkrieg [ Mo, 21 Januar 2008 11:18 ] [ ID #1913287 ]

Re: php under FastCGI

On 21 Jan, 10:18, drblitzkr... [at] gmail.com wrote:
> Problem: If you need to run regular php scripts under FastCGI, saving
> on the overhead of fopen'ing and reading in the contents before
> executing each time, in theory I guess you'd put a FastCgiServer
> directive in your httpd.conf, and direct it to some sort of app (could
> be written in C or anything) that loads and keeps in memory all your
> php files from your site, and runs their contents when a url request
> comes in for that file. Does such an app exist?

Yes - a ramdisk. But if you're using a sensible operating system it
will be cached anyway.

But more sensibly, a PHP accelerator will go even further by caching a
tokenized version of the script

C.
colin.mckinnon [ Mo, 21 Januar 2008 13:17 ] [ ID #1913292 ]

Re: php under FastCGI

On 1=D4=C221=C8=D5, =CF=C2=CE=E79=CA=B117=B7=D6, "C. (http://symcbean.blogsp=
ot.com/)"
<colin.mckin... [at] gmail.com> wrote:
> On 21 Jan, 10:18, drblitzkr... [at] gmail.com wrote:
>
> > Problem: If you need to run regularphpscriptsunderFastCGI, saving
> > on the overhead of fopen'ing and reading in the contents before
> > executing each time, in theory I guess you'd put a FastCgiServer
> > directive in your httpd.conf, and direct it to some sort of app (could
> > be written in C or anything) that loads and keeps in memory all your
> >phpfiles from your site, and runs their contents when a url request
> > comes in for that file. Does such an app exist?
>
> Yes - a ramdisk. But if you're using a sensible operating system it
> will be cached anyway.
>
> But more sensibly, aPHPaccelerator will go even further by caching a
> tokenized version of the script
>
> C.

Cool, thanks.
One thing: I'm using (from the sapi/cgi/php-cgi) and running my apps
instead of mod_php from apache, and it's not recognizing the mysql
functions. From strace I realized it wasn't finding php.ini, so I sym-
linked the correct one to where it was trying to look for it (/usr/
local/lib/php-cgi-fcgi.ini). Looks like it's finding it now, but still
not loading mysql - normally the mod_php executes /etc/php5/apache2/
php.ini and I guess at some point also executes the ones in /etc/php5/
conf.d, which are just 1 line each telling it to extension=3Dmysqli.so
or whatever the module is. I dumped the contents of all of these into /
etc/php5/fcgi/php.ini and set:

extension_dir =3D "/usr/lib/php5/20060613/"

which is where they are. How to get the sapi cgi php binary to load
the mysql and other modules correctly to use in running apps?

Thx.
drblitzkrieg [ Mi, 23 Januar 2008 11:40 ] [ ID #1914754 ]
PHP » comp.lang.php » php under FastCGI

Vorheriges Thema: status 3221225477 restarts apache on win 2003 with php and oracle
Nächstes Thema: Sessions