Apache PHP 7 PHP-FPM not working

Keith Smith techlists at phpcoderusa.com
Sun Sep 18 06:02:26 MST 2016




On 2016-09-17 20:05, Brien Dieterle wrote:
> Do you need to a2enmod php7?

Ran command which returned "ERROR: Module php7 does not exist!"

Google search showed I need to run "apt-get install 
libapache2-mod-php7.0".

Ran it and now PHP is working.

phpinfo() outputs "Server API 	Apache 2.0 Handler"  It is my 
understanding it should say "FPM/Fastcgi"

Had to comment out

#        <Directory /usr/lib/cgi-bin>
#                Require all granted
#        </Directory>
#        <IfModule mod_fastcgi.c>
#                ##SetHandler php7-fcgi .php
#               AddHandler php7-fcgi .php
#                Action php7-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>


and add

ProxyPassMatch ^/(.*\.php(/.*)?)$ 
unix:/run/php/php7.0-fpm.sock|fcgi://localhost/var/www/html/

Not sure the difference.  most of this was trial and error using two 
different tutorials.

Any resources you might suggest I read / follow?

Thank you for your help!!


> 
> On Sat, Sep 17, 2016 at 6:59 PM, Keith Smith
> <techlists at phpcoderusa.com> wrote:
> 
>> Hi,
>> 
>> I'm configuring Ubuntu 16.04 with Apache 2.4, PHP 7 PHP-FPM and
>> MariaDB.
>> 
>> If I go to the IP I see the default HTML page. I added a file
>> info.php with <?php phpinfo(); And when I go to the IP/info.php my
>> browser wants to download the file.
>> 
>> Here is roughly what I did:
>> 
>> apt-get -y install mariadb-server mariadb-client
>> mysql_secure_installation
>> apt-get -y install apache2
>> apt-get -y install php7.0 libapache2-mod-php7.0
>> apt-get -y install php7.0-mysql
>> 
>> added the following to
>> /etc/apache2/sites-available/000-default.conf
>> 
>> <Directory /usr/lib/cgi-bin>
>> Require all granted
>> </Directory>
>> 
>> <IfModule mod_fastcgi.c>
>> 
>> AddType application/x-httpd-php .php
>> AddType application/x-httpd-php .php7
>> Action application/x-httpd-php /php7-fcgi
>> 
>> AddHandler php7-fcgi .php
>> Action php7-fcgi /php7-fcgi
>> Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
>> # socket version
>> #FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi
>> -socket /var/run/php/php7.0-fpm.sock -pass-header Authorization
>> FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi
>> -flush -idle-timeout 300 -host 127.0.0.1:9000 [1] -pass-header
>> Authorization
>> </IfModule>
>> 
>> systemctl restart apache2
>> sudo a2enconf php7.0-fpm
>> service apache2 reload
>> I've also run service php7.0-fpm restart
>> 
>> Thank you in advance for any help!!
>> 
>> Keith
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss [2]
> 
> 
> 
> Links:
> ------
> [1] http://127.0.0.1:9000
> [2] http://lists.phxlinux.org/mailman/listinfo/plug-discuss
> 
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss

-- 
Keith Smith


More information about the PLUG-discuss mailing list