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]

 



Hello,

What you must remove is all scriptalias, addhandler/action directives.
So I'd say with a directive for each virtualhost you mentioned you
have you just would need (and of course disable mod_php module):

In one for one version pointing to 9002 port:
<FilesMatch \.(php|phar)$>
    SetHandler  "proxy:fcgi://localhost:9002"
</FilesMatch>

In the other virtualhost you  want to have pointing to 9003:
<FilesMatch \.(php|phar)$>
    SetHandler  "proxy:fcgi://localhost:9003"
</FilesMatch>

Apache is really much more simple and easier than many examples out
there try to show.

El jue, 8 abr 2021 a las 23:54, H (<agents@xxxxxxxxxxxxxx>) escribió:
>
> On 04/08/2021 05:06 PM, Daniel Ferradal wrote:
> > Hello,
> >
> > You mention PHP is set to listen to different tcp ports, yet the
> > config you show from apache points to a unix socket with
> > mod_proxy_fcgi
> >
> > Also worth mentioning you don't need php7_module at all when pointing
> > to FPM with mod_proxy_fcgi, so I would just unload that module asap in
> > case you have some other config lying around taking precedence and
> > causing the problems you mention.
> >
> > Cheers
> >
> > El jue, 8 abr 2021 a las 22:40, H (<agents@xxxxxxxxxxxxxx>) escribió:
> >> Using CentOS 7 and need to run two different versions of php for the websites, php 7.0 and 7.2. The set up is x.x.x.x/site1 and x.x.x.x/site2 and I am using php-fm for both php versions configuring port 9002 for php 7.0 and 9003 for php 7.2.
> >>
> >> I have a conf file for each site (this is site 1 which is supposed to run php 7.0) and called site1.conf, similar to:
> >>
> >> <VirtualHost *:80>
> >>         ServerAdmin xxx
> >>         ServerName x.x.x.x/site1
> >>         DocumentRoot /var/www/html/
> >>         DirectoryIndex info.php
> >>         ErrorLog /var/log/httpd/site1-error.log
> >>         CustomLog /var/log/httpd/site1-access.log combined
> >>
> >>     <IfModule !mod_php7.c>
> >>         <FilesMatch \.(php|phar)$>
> >>             SetHandler "proxy:unix:/var/opt/rh/rh-php70/run/php-fpm/www.sock|fcgi://localhost"
> >>         </FilesMatch>
> >>     </IfModule>
> >> </VirtualHost>
> >>
> >> The other site is identical and supposed to run php 7.2 so the file obviously uses site2 instead of site1 and php72 instead of php70.
> >>
> >> I have installed both php versions and can successfully switch between them on the commandline but have run into problem getting apache to use both. I consulted https://www.digitalocean.com/community/tutorials/how-to-run-multiple-php-versions-on-one-server-using-apache-and-php-fpm-on-centos-7 but apachectl configtest complains that "module php7_module is already loaded, skipping". I can successfully get the websites to use the same php version, either 7.0 or 7.2.
> >>
> >> I must have missed some configuration step and would appreciate any pointers.
> >>
> >> Thank you.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> >> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> >>
> >
> Thank you for your quick reply. I am sort of dabbling with apache and am not 100% sure what I need to change but would the following change to the above conf file be what you are telling me?
>
>      SetHandler "proxy:fcgi://localhost:9002
>      ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
>      AddHandler php70-fcgi .php
>      Action php70-fcgi /cgi-bin/php70.fcgi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>


-- 
Daniel Ferradal
HTTPD Project
#httpd help at Freenode

---------------------------------------------------------------------
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