Re: Running php 7.0 and 7.2 for different websites with apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> This is from ps aux | grep fpm:
> 
> root     17004  0.0  0.6 339008 11244 ?        Ss   01:18   0:00 php-fpm: master process
> (/etc/opt/rh/rh-php70/php-fpm.conf)
> apache   17005  0.0  0.3 339112  7352 ?        S    01:18   0:00 php-fpm: pool www
> apache   17006  0.0  0.3 339112  7356 ?        S    01:18   0:00 php-fpm: pool www
> apache   17007  0.0  0.4 339252  8452 ?        S    01:18   0:00 php-fpm: pool www
> apache   17008  0.0  0.3 339112  7360 ?        S    01:18   0:00 php-fpm: pool www
> apache   17009  0.0  0.3 339112  7368 ?        S    01:18   0:00 php-fpm: pool www
> root     17036  0.0  0.9 562800 18540 ?        Ss   01:18   0:00 php-fpm: master process
> (/etc/opt/rh/rh-php72/php-fpm.conf)
> apache   17037  0.0  0.3 562800  6976 ?        S    01:18   0:00 php-fpm: pool www
> apache   17038  0.0  0.3 562800  6976 ?        S    01:18   0:00 php-fpm: pool www
> apache   17039  0.0  0.3 562800  6976 ?        S    01:18   0:00 php-fpm: pool www
> apache   17040  0.0  0.3 562800  6976 ?        S    01:18   0:00 php-fpm: pool www
> apache   17041  0.0  0.3 562800  6980 ?        S    01:18   0:00 php-fpm: pool www
> 
> Does this not look correct?


Yes. It seems correct.

This is just one way, there are many, but it would work:
# 1) disable mod_php
# 2) enable mod_proxy and mod_proxy_fcgi
# 3) create a file called php7.0-fpm.conf that will handle PHP7.0 requests

<IfModule proxy_fcgi_module>
    # Enable http authorization headers
    <IfModule setenvif_module>
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
    <FilesMatch ".+\.ph(ar|p|tml)$">
        SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost"
	# or if you prefer use TCP instead of UX socket
	#SetHandler "proxy:fcgi://localhost:9002"
    </FilesMatch>
</IfModule>

# 4) create a file called php7.2-fpm.conf that will handle PHP7.2 requests

<IfModule proxy_fcgi_module>
    # Enable http authorization headers
    <IfModule setenvif_module>
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
    <FilesMatch ".+\.ph(ar|p|tml)$">
        SetHandler "proxy:unix:/run/php/php7.2-fpm.sock|fcgi://localhost"
	# or if you prefer use TCP instead of UX socket
	#SetHandler "proxy:fcgi://localhost:9003"
    </FilesMatch>
</IfModule>

# 5) inside your virtualhosts, include the desired PHP conf file:
# eg: Include /yourconfpath/php7.2-fpm.conf

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux