I Have Apache2-Prefork running using mod_php and php 5.2.
And i also have php-fpm with php 5.3 running inside a chrooted environment (listening to an unix socket which would be reachable for apache)
Can someone please guide me how i have to configure a Virtualhost to use Fastcgi. (I've been searching the web for an example, but didnt find anything...)
And there is a point that confuses me...
if php runs across an include or fopen in which context will that be executed? Apaches or the chrooted environment?
Can i still pass php directives over httpd.conf and .htaccess?
The whole FastCGI thing is still pretty confusing for me :) thanks in advance for any help!
Update: I'm pretty sure that i have to use mod_fastcgi and the FastCgiExternalServer directive. But i dont know how to tell apache that he sould do that only to .php files
In your Apache virtualhost directive, you configure a php5 handler,
In that instance, the FCGIWrapper entry is the php5 cgi binary. Other examples suggest creating your own script and calling that, having that script set options and in turn calling php.
For example,
If you go with a wrapper script you can set options in that, if you don't (i.e. the first example), then you can set options directly in the Apache config files,
That's pretty much it for a basic FastCGI config, some of it varies by distribution or if it's self compiled, but the above is the basic necessary stuff.
There appears to be quite an extensive FAQ on something very similar to your query here,
Apache + Chroot + FastCGI + PHP FAQ - http://www.seaoffire.net/fcgi-faq.html
I wrote about this i my blog some time ago, with full examples and all. Here is the part about Apache + PHP FPM: http://blog.foaa.de/2010/11/php-apache-and-fastcgi-a-comprehensive-overview/#implementation.
If you scroll up, it also covers also a multitude of other (mostly outdated) ways implementing Apache + FastCGI. If nothing else, it might give you a deeper understanding on how FastCGI and Apache can communicate.