Eu tive o mesmo problema e, como HBruijn apontou, a questão era Selinux.
eu corri:
setenforce 0
Então eu o desabilitei no / etc / selinux / config:
SELINUX=disabled
Estou tentando configurar o FastCGI para trabalhar com PHP no Apache 2.4.6 (CentOS).
Estou seguindo as instruções verbatim dos documentos: link
/etc/httpd/conf/httpd.conf
:
...
<Directory "/var/www/mybin">
Options all
Order allow,deny
Allow from all
</Directory>
FcgidMaxRequestsPerProcess 10000
Alias /phpapp/ /var/www/myphpapp/
<Location "/phpapp/">
Options +ExecCGI
AddHandler fcgid-script .php
FcgidWrapper /var/www/mybin/php-wrapper .php
Order allow,deny
Allow from all
</Location>
...
ls -al /var/www/{,mybin,myphpapp}
(observe os 0777 permanentes em tudo que for relevante)
/var/www/:
total 4
drwxr-xr-x. 6 root root 68 Sep 18 20:51 .
drwxr-xr-x. 20 root root 4096 Sep 18 01:04 ..
drwxr-xr-x. 4 root root 32 Sep 18 15:02 html
drwxrwxrwx. 2 root root 24 Sep 18 20:35 mybin
drwxrwxrwx. 2 root root 18 Sep 18 20:20 myphpapp
/var/www/mybin:
total 4
drwxrwxrwx. 2 root root 24 Sep 18 20:35 .
drwxr-xr-x. 6 root root 68 Sep 18 20:51 ..
-rwxrwxrwx. 1 root root 23 Sep 18 20:01 php-wrapper
/var/www/myphpapp:
total 4
drwxrwxrwx. 2 root root 18 Sep 18 20:20 .
drwxr-xr-x. 6 root root 68 Sep 18 20:51 ..
-rwxrwxrwx. 1 root root 19 Sep 18 20:03 a.php
systemctl start httpd
falha, então vamos ver o que há de errado com systemctl -l status httpd
:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2016-09-18 20:53:46 EDT; 58s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 6963 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 6961 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 6961 (code=exited, status=1/FAILURE)
Sep 18 20:53:46 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Sep 18 20:53:46 localhost.localdomain httpd[6961]: AH00526: Syntax error on line 264 of /etc/httpd/conf/httpd.conf:
Sep 18 20:53:46 localhost.localdomain httpd[6961]: Wrapper /var/www/mybin/php-wrapper cannot be accessed: (13)Permission denied
Sep 18 20:53:46 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Sep 18 20:53:46 localhost.localdomain kill[6963]: kill: cannot find process ""
Sep 18 20:53:46 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
Sep 18 20:53:46 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Sep 18 20:53:46 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Sep 18 20:53:46 localhost.localdomain systemd[1]: httpd.service failed.
Ele reclama na linha 264, que é a linha com FcgidWrapper
, dizendo Permissão negada.
Onde posso especificar que o Apache deve ter permissão para acessar meu arquivo php-wrapper
?
Eu tive o mesmo problema e, como HBruijn apontou, a questão era Selinux.
eu corri:
setenforce 0
Então eu o desabilitei no / etc / selinux / config:
SELINUX=disabled
Tags php fastcgi apache-2.4