Issue
(With the tutorial and afterwards with the help of Thomas Christlieb)
The configuration used right now is the following :
System runs on an "old" HP EliteBook,
which should run as test server before going live + backup server
SystemOS : Linux Mint 18.3 (based on Ubuntu 16.04)
Access to Site via Windows PC in same Network
To install the LAMP Server + fpm modules, I followed this steps :
sudo apt-get install apache2 apache2-utils mysql-server phpmyadmin
sudo a2dismod php7.2 (which was installed with phpmyadmin)
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libapache2-mod-fastcgi libapache2-mod-fcgid
sudo apt-get install php5.6-fpm php5.6 php5.6-mcrypt php5.6-mbstring php5.6-mysql php5.6-zip php5.6-gd php5.6-xml
sudo apt-get install php7.0-fpm php7.0 php7.0-mcrypt php7.0-mbstring php7.0-mysql php7.0-zip php7.0-gd php7.0-xml
sudo a2enmod actions
sudo a2enmod fastcgi
sudo a2enmod fcgid
sudo a2enmod rewrite
sudo a2enmod suexec
sudo a2enmod include
(a2enmod's just to check if they are already enabled)sudo service apache2 restart
(to restart the server so everything will be loaded correctly)- created 2 files in
/etc/apache2/sites-available
, onephp56.conf
, onephp70.conf
- created 2 directorys in
/var/www/html
, one PHP 5.6, one PHP 7.0 sudo a2dissite 000-default
(disable default site)sudo a2ensite php56 php70
(enable PHP 5.6 & PHP 7.0 site)sudo service apache2 restart
/etc/apache2/sites-available/php56.conf :
<IfModule mod_fastcgi.c> AddHandler php56-fcgi-www .php Action php56-fcgi-www /php56-fcgi-www Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php/php5.6-fpm.sock -pass-header Authorization <Directory "usr/lib/cgi-bin"> Require all granted </Directory> </IfModule> <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName php56 DocumentRoot /var/www/html/php56 <Directory "/var/www/html/php56"> Options Indexes FollowSymLinks MultiViews AllowOverride All SetHandler php56-fcgi-www </Directory> ErrorLog $(APACHE_LOG_DIR)/error.log CustomLog $(APACHE_LOG_DIR)/access.log combined </VirtualHost>
/etc/apache2/sites-available/php70.conf :
<IfModule mod_fastcgi.c> AddHandler php70-fcgi-www .php Action php70-fcgi-www /php70-fcgi-www Alias /php70-fcgi-www /usr/lib/cgi-bin/php70-fcgi-www FastCgiExternalServer /usr/lib/cgi-bin/php70-fcgi-www -socket /run/php/php7.0-fpm.sock -pass-header Authorization <Directory "usr/lib/cgi-bin"> Require all granted </Directory> </IfModule> <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName php70 DocumentRoot /var/www/html/php70 <Directory "/var/www/html/php70"> Options Indexes FollowSymLinks MultiViews AllowOverride All SetHandler php70-fcgi-www </Directory> ErrorLog $(APACHE_LOG_DIR)/error.log CustomLog $(APACHE_LOG_DIR)/access.log combined </VirtualHost>
In both PHP 5.6 & PHP 7.0 Directories I created a file
info.php
<?php phpinfo() ?>
sudo service apache2 restart
(to reload the changed configuration)
So now the LAMP Server is installed with php5.6-fpm
& php7.0-fpm
but now my first problem occurs.
When I open PHP 7.0 Site in Web browser it shows me the correct phpinfo()
which tells me :
PHP Version 7.0.27-1 + ubuntu16.04.1 + deb.sury.org + 1 Server API FPM/FastCGI Loaded Configuration File /etc/php/7.0/fpm/php.ini ...
But when I open the PHP 5.6 site in web browser it shows me the exact same phpinfo()
output.
So I tried disabling the PHP 7.0 site to check whether or not my PHP 5.6 config might be corrupt.
sudo a2dissite php70
sudo service apache2 reload
Now when I open PHP 5.6 (same for PHP 7.0) it shows me the phpinfo
for PHP Version 5.6 like this :
PHP Version 5.6.33-3 + ubuntu16.04.1 + deb.sury.org + 1 Server API FPM/FastCGI Loaded Configuration File /etc/php/5.6/fpm/php.ini ...
From there on I asked Thomas Christlieb for help and with his instructions I made the following :
a2dissite php56 php70
(to disable both site configuration files)a2ensite 000-default
(to enable the default configuration file again)Made the following modifications to '/etc/apache2/sites-available/000-default.conf'
<IfModule mod_fastcgi.c> AddHandler php56-fcgi-www .php Action php56-fcgi-www /php56-fcgi-www Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php5.6-fpm.sock -pass-header Authorization <Directory "/usr/lib/cgi-bin"> Require all granted </Directory> AddHandler php70-fcgi-www .php Action php70-fcgi-www /php70-fcgi-www Alias /php70-fcgi-www /usr/lib/cgi-bin/php70-fcgi-www FastCgiExternalServer /usr/lib/cgi-bin/php70-fcgi-www -socket /run/php7.0-fpm.sock -pass-header Authorization <Directory "/usr/lib/cgi-bin"> Require all granted </Directory> </IfModule> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <Directory "/var/www/html/php70"> Options Indexes FollowSymLinks MultiViews AllowOverride All SetHandler php70-fcgi-www </Directory> <Directory "/var/www/html/php56"> Options Indexes FollowSymLinks MultiViews AllowOverride All SetHandler php56-fcgi-www </Directory> </VirtualHost>
sudo service apache2 restart
(to reload the new configuration)
So but now when I open both sites, I get the exact same error Message 'Internal Server Error', but those two messages are in a different font, which I suppose could mean that it should work like this, because otherwise they should be exactly the same, or am I wrong?
I googled around a lot, also looked up on here, but the this problem wasn't really present as I don't use docker nor Nginx in my configuration. Maybe someone already had a problem like this and could tell me how to resolve the last step that I am missing.
Access.log Information
...
100.100.100.11 - - [20/Feb/2018:08:26:14 +0100] "GET /php56/info.php HTTP/1.1" 500 805 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0"
100.100.100.11 - - [20/Feb/2018:08:37:35 +0100] "GET /php56/info.php HTTP/1.1" 500 805 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0"
...
Error.log Information
...
[Tue Feb 20 09:30:08.166199 2018] [fastcgi:error] [pid 27475] (2)No such file or directory: [client 100.100.100.11:52772] FastCGI: failed to connect to server "/usr/lib/cgi-bin/php56-fcgi-www": connect() failed
[Tue Feb 20 09:30:08.166574 2018] [fastcgi:error] [pid 27475] [client 100.100.100.11:52772] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php56-fcgi-www"
...
This is what I noticed now while looking trough the Error.log
but I don't know why it says so.
I checked the status of php5.6-fpm
, php7.0-fpm
, apache2
, they are all 3 active (running) so I can't help myself anymore and need help.
Solution
So no more need for an answer, Thomas Christlieb found the problem now.
In my 000-default.conf the FastCgiExternalServer i had a wrong path inside.
He changed /run/php5.6-fpm.sock to /run/php/php5.6-fpm.sock
and /run/php7.0-fpm.sock to /run/php/php7.0-fpm.sock
and now everything works just fine as it should.
Thanks.
Answered By - De Rond Sascha Answer Checked By - Cary Denson (WPSolving Admin)