Dear all,



I'm new here and notsure this place is where I can posts these questions but I 
have beentrying to configure my Ubuntu 16.04 VPS to use PHP-FPM with Apache2.




I followed thissource:

1.https://www.howtoforge.com/tutorial/apache-with-php-fpm-on-ubuntu-16-04/




Modified this file:

/etc/apache2/sites-available/000-default.confto now have this inside:




 <Directory/usr/lib/cgi-bin>

  Require allgranted

  </Directory>

  <IfModulemod_fastcgi.c>

  AddHandlerphp7-fcgi .php

  Actionphp7-fcgi /php7-fcgi virtual

  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>




Also modified thisfile /etc/apache2/conf-available and now it contains




# Redirect to localphp-fpm if mod_php is not available

<IfModule!mod_php7.c>

  # Enable httpauthorization 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 accessto raw php sources by default

  # Tore-enable it's recommended to enable access to the files

  # only inspecific virtual host or directory

  Require alldenied

  </FilesMatch>

  # Deny accessto files without filename (e.g. '.php')

  <FilesMatch"^\.ph(p[3457]?|t|tml|ps)$">

  Require alldenied

  </FilesMatch>

</IfModule>




However, when I lookat the output of the info.php page I have created in the 
documentroot I see Server API --> Apache 2.0 Handler in stead of what Iexpected 
after fiddling with the configuration. I expected Server API--> FPM/FastCGI




What I find strange,is the contents of /run/php and the size of the 
php7.0-fpm.sock, thewww-data and s in front of the directory but don't know if 
this hasanything to do with it.




/run/php$ ls -l

total 4

-rw-r--r-- 1 root root  4 Jul  3 02:18 php7.0-fpm.pid

srw-rw---- 1www-data www-data 0 Jul  3 02:18 php7.0-fpm.sock




Command uname -agives:

4.4.0-83-generic#106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 
x86_64GNU/Linux




Command dpkg -l |grep apache gives

ii  apache2 2.4.18-2ubuntu3.3  amd64  Apache HTTP Server

ii apache2-bin  2.4.18-2ubuntu3.3  amd64  Apache HTTPServer (modules and other 
binary files)

ii apache2-data  2.4.18-2ubuntu3.3  all  Apache HTTPServer (common files)

ii apache2-utils  2.4.18-2ubuntu3.3  amd64  Apache HTTPServer (utility programs 
for web servers)

ii libapache2-mod-fastcgi  2.4.7~0910052141-1.2  amd64 Apache 2 FastCGI module 
for long-running CGI scripts

ii libapache2-mod-php7.0  7.0.18-0ubuntu0.16.04.1  amd64 server-side, 
HTML-embedded scripting language (Apache 2 module)




Command dpkg -l |grep php gives:

ii libapache2-mod-php7.0  7.0.18-0ubuntu0.16.04.1  amd64 server-side, 
HTML-embedded scripting language (Apache 2 module)

ii  php-common 1:35ubuntu6  all  Common files for PHP packages

ii php-imagick  3.4.0~rc6-1ubuntu3  amd64  Provides awrapper to the ImageMagick 
library

ii  php-pear 1:1.10.1+submodules+notgz-6  all  PEAR Base System

ii  php-xml 1:7.0+35ubuntu6  all  DOM, SimpleXML, WDDX, XML, and XSLmodule for 
PHP [default]

ii  php7.0 7.0.18-0ubuntu0.16.04.1  all  server-side, HTML-embeddedscripting 
language (metapackage)

ii  php7.0-cli 7.0.18-0ubuntu0.16.04.1  amd64  command-line interpreterfor the 
PHP scripting language

ii php7.0-common  7.0.18-0ubuntu0.16.04.1  amd64 documentation, examples and 
common module for PHP

ii php7.0-curl  7.0.18-0ubuntu0.16.04.1  amd64  CURLmodule for PHP

ii  php7.0-fpm 7.0.18-0ubuntu0.16.04.1  amd64  server-side, 
HTML-embeddedscripting language (FPM-CGI binary)

ii  php7.0-gd 7.0.18-0ubuntu0.16.04.1  amd64  GD module for PHP

ii php7.0-imap  7.0.18-0ubuntu0.16.04.1  amd64  IMAPmodule for PHP

ii php7.0-intl  7.0.18-0ubuntu0.16.04.1  amd64 Internationalisation module for 
PHP

ii php7.0-json  7.0.18-0ubuntu0.16.04.1  amd64  JSONmodule for PHP

ii php7.0-mcrypt  7.0.18-0ubuntu0.16.04.1  amd64 libmcrypt module for PHP

ii php7.0-mysql  7.0.18-0ubuntu0.16.04.1  amd64  MySQLmodule for PHP

ii php7.0-opcache  7.0.18-0ubuntu0.16.04.1  amd64  ZendOpCache module for PHP

ii php7.0-pspell  7.0.18-0ubuntu0.16.04.1  amd64  pspellmodule for PHP

ii php7.0-readline  7.0.18-0ubuntu0.16.04.1  amd64 readline module for PHP

ii php7.0-recode  7.0.18-0ubuntu0.16.04.1  amd64  recodemodule for PHP

ii php7.0-snmp  7.0.18-0ubuntu0.16.04.1  amd64  SNMPmodule for PHP

ii php7.0-sqlite3  7.0.18-0ubuntu0.16.04.1  amd64 SQLite3 module for PHP

ii php7.0-tidy  7.0.18-0ubuntu0.16.04.1  amd64  tidymodule for PHP

ii  php7.0-xml 7.0.18-0ubuntu0.16.04.1  amd64  DOM, SimpleXML, WDDX, XML,and 
XSL module for PHP

ii php7.0-xmlrpc  7.0.18-0ubuntu0.16.04.1  amd64 XMLRPC-EPI module for PHP

ii  php7.0-xsl 7.0.18-0ubuntu0.16.04.1  all  XSL module for PHP (dummy)







What have I missedand what should I do to have apache2 run with FastCGI?




With kind regards,




Dino Vliet

Reply via email to