Настройте PHP-FPM на LinuxMint

663
NaeiKinDus

В настоящее время я пытаюсь установить PHP-FPM на Linux Mint 18 (Сара). Я пытался заставить это работать часами, если не днями, но безрезультатно.

Похоже, что PHP-FPM не вызывается, поскольку я всегда получаю код PHP при запросе страницы, а не ожидаемую веб-страницу, т.е.

Запрос:

GET /phpinfo.php 

Отклик:

<?php phpinfo(); 

Ожидаемое:

phpinfo() PHP Version => 7.0.8-0ubuntu0.16.04.3  System => Linux[...] 

Другая «подсказка» о том, что PHP-FPM не вызывается, заключается в том, что даже если я остановлю его, ответ веб-страницы будет таким же.

Спасибо за любую помощь!

Вот спецификации:

  • Linux Mint 18
  • Apache 2.4.18
  • PHP 7 (устанавливается с помощью apt-get)
  • PHP-FPM (используя apt-get)
  • libapache2-мод-FastCGI

Моды включены:

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 

Содержимое VirtualHost (только один включен):

<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 $/error.log CustomLog $/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> 

Содержимое файла fastcgi.conf:

<IfModule mod_fastcgi.c> AddHandler fastcgi-script .fcgi #FastCgiWrapper /usr/lib/apache2/suexec FastCgiIpcDir /var/lib/apache2/fastcgi </IfModule> 

Содержимое файла php7.0-fpm.conf (загружено):

# 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> 
0
Я установил несколько виртуальных хостов на apache-2.4. Не стоит добавлять эту конфигурацию на все виртуальные хосты. Можем ли мы настроить все виртуальные хосты? Nullpointer 6 лет назад 0
@Nullpointer, вы бы предпочли создать новый вопрос, а не постить посторонний. NaeiKinDus 6 лет назад 0

0 ответов на вопрос

Похожие вопросы