0

I try to setup php-fpm with apache

I am still missing a piece of the puzzle, because the page returns a 404

The requested URL /php-fpm/index.php was not found on this server. Apache/2.2.24 (Unix) DAV/2 mod_fastcgi/2.4.6 Server at test.dev Port 80 

From what I understand sofar is that the path mentioned in the alias does not have to exist, but it should match with the following ExternalServer directive. The socket path is exactly the same as has been set in the php-fpm config. I chmodded -R 777 the var and the tmp directory and the site directory. I saw that the socket and the fastcgi have the same owners "_www", those are the default settings and saw no need to change them.

php54 --with-php-fpm, mod_fastcgi are installed with Homebrew, but this guide did not help me either

What else can I do? Any suggestions very much appreciated.

this is what is in my httpd

<IfModule mod_fastcgi.c> # <FilesMatch \.php$> # SetHandler php-script # </FilesMatch> # Action php-script /php.external # Alias /php.external /var/run/mod_fastcgi/php.fpm AddHandler php-fastcgi .php Action php-fastcgi /php-fpm Alias /php-fpm /var/run/mod_fastcgi/php.fpm FastCGIExternalServer /var/run/mod_fastcgi/php.fpm -socket /tmp/php-fpm.sock -idle-timeout 900 -pass-header Authorization AddType application/x-httpd-fastphp5 .php DirectoryIndex index.php index.shtml index.cgi index.html index.htm Options +Indexes +FollowSymLinks +ExecCGI +Includes +MultiViews <Directory "/var/run/mod_fastcgi/"> Order deny,allow Deny from all <Files "php.fpm"> Order allow,deny Allow from all </Files> </Directory> </IfModule> <VirtualHost *> DocumentRoot "/Users/redres/Webdev/testsite/public" ServerName test.dev ServerAlias www.test.dev <Location /php-fpm> Order Deny,Allow Deny from all Allow from env=REDIRECT_STATUS </Location> 
1
  • what is the exact benefit please to use mod_fastcgi instead of proxying all request with mod_proxy_fcgi to fpm? It sounds to me as another layer which is not necessary because FPM itself is FastCGI implementation. Commented Jun 6, 2019 at 13:24

1 Answer 1

2

I struggled with Apache 2.2 and PHP-FPM for days, until I realized that it didn't work unless FastCgiWrapper was set to Off. Not sure if this makes any difference for you, but it fixed my problems. Be aware that any FastCgi scripts executed by Apache will not run through suexec after this. PHP-FPM does not need this, but you may have other FastCgi instances running.

1
  • It might be usefull if I could find the directive? Commented Oct 15, 2013 at 13:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.