2

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

Highway of Life
  • 506
  • 1
  • 7
  • 14

2 Answers2

1

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

0

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.

Ben Lessani
  • 5,244
  • 17
  • 37