0
1
I am currently trying to install PHP-FPM on a Linux Mint 18 (Sarah). I have been trying to get this to work for hours if not days, to no avail.
The PHP-FPM does not seem to be called since I always get the PHP code when querying a page, instead of getting the expected webpage, ie.:
Query:
GET /phpinfo.php
Response:
<?php
phpinfo();
Expected:
phpinfo()
PHP Version => 7.0.8-0ubuntu0.16.04.3
System => Linux[...]
Another "clue" that PHP-FPM is not called is that even if I stop it, the webpage response is the same.
Thanks for any help provided !
Here are the specs:
- Linux Mint 18
- Apache 2.4.18
- PHP 7 (installed using apt-get)
- PHP-FPM (using apt-get)
- libapache2-mod-fastcgi
Mods enabled:
access_compat.load
actions.conf
actions.load
alias.conf
alias.load
auth_basic.load
authn_core.load
authn_file.load
authz_core.load
authz_host.load
authz_user.load
autoindex.conf
autoindex.load
deflate.conf
deflate.load
dir.conf
dir.load
env.load
fastcgi.conf
fastcgi.load
filter.load
mime.conf
mime.load
mpm_event.conf
mpm_event.load
negotiation.conf
negotiation.load
rewrite.load
setenvif.conf
setenvif.load
status.conf
status.load
Content of the VirtualHost (only one enabled):
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName some.server.name
ServerAdmin webmaster@localhost
DocumentRoot /opt/git/NetDev/NetworkWebsite/web
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /opt/git/NetDev/NetworkWebsite/web>
Options FollowSymlinks
DirectoryIndex app_dev.php
AllowOverride All
Require all granted
</Directory>
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Content of the fastcgi.conf file:
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
#FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/lib/apache2/fastcgi
</IfModule>
Content of the php7.0-fpm.conf file (loaded):
# Redirect to local php-fpm if mod_php is not available
<IfModule !mod_php7.c>
# Enable http authorization headers
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
<FilesMatch ".+\.ph(p[3457]?|t|tml)$">
SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost"
</FilesMatch>
<FilesMatch ".+\.phps$">
# Deny access to raw php sources by default
# To re-enable it's recommended to enable access to the files
# only in specific virtual host or directory
Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(p[3457]?|t|tml|ps)$">
Require all denied
</FilesMatch>
</IfModule>
<IfModule mod_fastcgi.c>
AddHandler php7-fcgi .php
Action php7-fcgi /php7-fcgi
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /var/run/php/php7.0-fpm.sock -pass-header Authorization
</IfModule>
I've setup multiple virtualhost on apache-2.4, It is not good to add this config on all virtual host, Can we setup for all virtualhost? – Nullpointer – 2017-07-25T12:33:45.210
@Nullpointer you'd rather create a new question than post on an unrelated one. – NaeiKinDus – 2017-07-25T13:27:43.980