php under FastCGI

php under FastCGI

am 21.01.2008 11:18:25 von drblitzkrieg

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?

Re: php under FastCGI

am 21.01.2008 13:17:38 von colin.mckinnon

On 21 Jan, 10:18, drblitzkr...@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.

Re: php under FastCGI

am 23.01.2008 11:40:38 von drblitzkrieg

On 1ÔÂ21ÈÕ, ÏÂÎç9ʱ17·Ö, "C. (http://symcbean.blogsp=
ot.com/)"
wrote:
> On 21 Jan, 10:18, drblitzkr...@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.