Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How would it be possible to run certain scripts (this could be in either a vhost or directory setting in the apache conf) to run as mod_php when the current server configuration is running FPM/FastCGI?

Server OS: Ubuntu-Server 11.04

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Well, the easy answer would be just to install mod_php and php_fcgi - and do not define the x-application PHP handler in any of your configs. Then it would use mod_php.

share|improve this answer

To run PHP both with mod_php and fastcgi, you can also use PHP-FPM and Apache mod_actions

Install mod_fcgi and mod_actions for Apache. Install and configure PHP-FPM.

And add to the virtual host config following block

<IfModule mod_fastcgi.c>
<IfModule mod_actions.c>
    FastCGIExternalServer /var/www/<document_root_path>/php.fastcgi -socket /var/run/php-fpm.sock

    Action php-fcgi-script /php.fastcgi virtual

    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
        SetHandler php-fcgi-script
    </FilesMatch>
</IfModule>
</IfModule>

I prefer to run PHP-FPM listening a UNIX socket.

But you can also configure your PHP-FPM to run on local port, so you should change -socket config parameter to the -host ip:port

FastCGIExternalServer configuration http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.