Answer the question
In order to leave comments, you need to log in
How to switch php versions?
Please help me to configure correctly to use different versions of php for different hosts. To switch either in htaccess or in the hosts settings. On the Internet, what I found requires suphp, but it is not in debian stretch and is not built from source on the cubieboard. In general, there are apache 2.4 with the fastcgi module, php5.6-fpm, php7-fpm, it remains only to configure it correctly so that everything works.
now I have this:
/etc/apache2/mods-enabled/fastcgi.conf
<IfModule mod_fastcgi.c>
AddType application/x-httpd-fastphp .php
Action application/x-httpd-fastphp /php-fcgi
# PHP5
# Alias /php-fcgi /usr/lib/cgi-bin/php5-fcgi
# FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -appConnTimeout 10 -idle-timeout 250 -socket /var/run/php5-fpm.sock -pass-header Authorization
# PHP7
Alias /php-fcgi /usr/lib/cgi-bin/php
FastCgiExternalServer /usr/lib/cgi-bin/php -appConnTimeout 10 -idle-timeout 250 -socket /run/php/php7.0-fpm.sock -pass-header Authorization
# Apache 2.4+
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
#
Alias /php-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -appConnTimeout 10 -idle-timeout 250 -socket /var/run/php5-fpm.sock -pass-header Authorization
Answer the question
In order to leave comments, you need to log in
In general, I solved the problem myself
/etc/apache2/mods-enabled/fastcgi.conf
<IfModule mod_fastcgi.c>
AddType application/x-httpd-php5 .php
Action application/x-httpd-php5 /php-fcgi5
AddType application/x-httpd-php7 .php
Action application/x-httpd-php7 /php-fcgi7
# PHP5
Alias /php-fcgi5 /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -appConnTimeout 10 -idle-timeout 250 -socket /var/run/php5-fpm.s$
# PHP7
Alias /php-fcgi7 /usr/lib/cgi-bin/php
FastCgiExternalServer /usr/lib/cgi-bin/php -appConnTimeout 10 -idle-timeout 250 -socket /run/php/php7.0-fpm.sock $
# Apache 2.4+
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
#
</IfModule>
<FilesMatch "\.php">
SetHandler application/x-httpd-php5
</FilesMatch>
<FilesMatch "\.php">
SetHandler application/x-httpd-php7
</FilesMatch>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question