S
S
Sergey Brovko2017-11-06 23:25:36
PHP
Sergey Brovko, 2017-11-06 23:25:36

How to switch PHP version?

Hello, the subject is actually interesting, there is Apache 2.4, there are several versions of PHP that work like FPM, each on its own port, and there is a bunch of even programs that need to periodically switch the PHP version. All this on CentOS. I wanted to make it so that it is enough to change the same .htaccess in the root of the site and the version has changed, but for some reason it does not work. I did this with nginx, but Apache is needed. Help, I saw something on the Internet - it does not work as it should

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Sergey Brovko, 2017-11-10
@cyber01

The results are: phpbrew - not quite suitable, docker is not necessary, nginx is not installed. there are legacy applications that only work with apache.
As a result, apache + fcgid solved the problem and the PHP version was switched simply by changing the line in .htaccess.

O
OnYourLips, 2017-11-07
@OnYourLips

Install nginx with different versions of php connected via fastcgi.
You can put Apache before nginx (but why?)

N
Nikita Kit, 2017-11-06
@ShadowOfCasper

Thanks Please
https://github.com/phpbrew/phpbrew

I
Ivan, 2017-11-07
@LiguidCool

To all of the above, there is Docker.

A
Alexey Skobkin, 2017-11-07
@skobkin

Linux distributions may have a special tool for this. For example, eselect or update-alternatives.
In general, Docker solves such problems quite well (if each stack component is in a separate container).

A
Andrey Stepanov, 2017-11-07
@leoykt

for such tasks, Docker is a very elegant solution, because if you fence many FPM instances, this will create unnecessary complexity in configuration. You can allocate webroot to the shared volume of the file system, php.ini and others like them for each instance also there so that you can quickly tune, let Apache run there with its settings and the required version of PHP on each docker instance.
Further, at the nginx input, simply proxy_pass, allocating a virtual hostname for each docker instance like
1. ver1.mysite.php56.local
1. ver1.mysite.php70.local
1.
ver1.mysite.php71.local in the host of overly complex configs, gracefully isolate each PHP instance for the required version, and, in principle, debug at the same time
well, essno in the debiloper's computer, drive the required hosts into hosts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question