On 04/09/2021 06:03 AM, Daniel Ferradal wrote:
> Looks correct yes. But still lots of things you are not showing could be wrong.
>
> To solve issues you have to go one thing at a time, you know for sure
> apache is pointing to different ports, if you disabled mod_php. Now
> you must make sure the fpm pools are correct, both versions listening
> to each port, that you disabled all mod_php stuff, etc. things we
> can't see because you don't show, so it is quite hard to hand-guide
> you with just small bits of info.
>
> El vie, 9 abr 2021 a las 3:26, H (<agents@meddatainc.com>) escribió:
>> On 04/08/2021 08:57 PM, Daniel Ferradal wrote:
>>> There is no such thing as default php version for a site.
>>>
>>> You have to make sure you have really two different instances of
>>> php-fpm running for the different php versions you want to use.
>>>
>>> Chances are you have the same php-fpm service with two pools, so both
>>> may be with the same version.
>>>
>>> Apache doesn't care what you do from now on, since it is just reverse
>>> proxying requests to the selected servers. So it is up to you and your
>>> php-fpm config and how you start them now.
>>>
>>> El vie, 9 abr 2021 a las 1:55, H (<agents@meddatainc.com>) escribió:
>>>> On 04/08/2021 07:34 PM, H wrote:
>>>>> On 04/08/2021 06:05 PM, Daniel Ferradal wrote:
>>>>>> 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@meddatainc.com>) 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@meddatainc.com>) 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@httpd.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>>>>>>
>>>>>>> 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@httpd.apache.org
>>>>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>>>>
>>>>> This is what I did:
>>>>>
>>>>> - I disabled what I think are the php_mod statements in both 15-rh-php70-php.conf and 15-rh-php72-php.conf by inserting #disabled in front of "LoadModule php7_module modules/librh-php70-php7.so" in the former and the equivalent in the latter.
>>>>>
>>>>> - For the the site1.conf I have:
>>>>>
>>>>> <VirtualHost *:80>
>>>>> ServerAdmin xxx
>>>>> ServerName x.x.x.x
>>>>> DocumentRoot /var/www/html/
>>>>> ErrorLog /var/log/httpd/site1-error.log
>>>>> CustomLog /var/log/httpd/site1-access.log combined
>>>>>
>>>>> <FilesMatch \.(php|phar)$>
>>>>> SetHandler "proxy:fcgi://localhost:9002"
>>>>> </FilesMatch>
>>>>> </VirtualHost>
>>>>>
>>>>> and for site2.conf
>>>>>
>>>>> <VirtualHost *:80>
>>>>> ServerAdmin xxx
>>>>> ServerName x.x.x.x
>>>>> DocumentRoot /var/www/html/
>>>>> ErrorLog /var/log/httpd/site2-error.log
>>>>> CustomLog /var/log/httpd/site2-access.log combined
>>>>>
>>>>> <FilesMatch \.(php|phar)$>
>>>>> SetHandler "proxy:fcgi://localhost:9003"
>>>>> </FilesMatch>
>>>>> </VirtualHost>
>>>>>
>>>>> - I have checked that I have both rh-php70-php-fpm and rh-php72-php-fpm running and one is listening on port 9002 and the other on 9003.
>>>>>
>>>>> Yet, when I check the php version in a html page in each of the site directories I only see php 7.0 loading.
>>>>>
>>>>> So, there must be something more I need to do?
>>>>>
>>>>> Another question, I found that the Customlogs above catch messages from all sites, not just site1 or site2 respectively. How can I change so that each CustomLog only catches accesses for that particular site?
>>>>>
>>>> How does the system define which the "default" php version for a particular site? Or is there no default and I have to write a eg site3.conf file specifying the port for each site?
>>>>
>>>> I should have added that I access the sites like this: x.x.x.x/site1 and x.x.x.x/site2 etc.
>>>>
>>>> And I restarted httpd after each change.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>
>> 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?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
You write "both versions listening to each port", I have each version listening to its port, ie php 70 to 9002 and php 72 to 9003 as confirmed by netstat -tlpn.
By the way, here are my httpd modules:
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
access_compat_module (shared)
actions_module (shared)
alias_module (shared)
allowmethods_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
authn_anon_module (shared)
authn_core_module (shared)
authn_dbd_module (shared)
authn_dbm_module (shared)
authn_file_module (shared)
authn_socache_module (shared)
authz_core_module (shared)
authz_dbd_module (shared)
authz_dbm_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_owner_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cache_module (shared)
cache_disk_module (shared)
data_module (shared)
dbd_module (shared)
deflate_module (shared)
dir_module (shared)
dumpio_module (shared)
echo_module (shared)
env_module (shared)
expires_module (shared)
ext_filter_module (shared)
filter_module (shared)
headers_module (shared)
include_module (shared)
info_module (shared)
log_config_module (shared)
logio_module (shared)
mime_magic_module (shared)
mime_module (shared)
negotiation_module (shared)
remoteip_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
slotmem_plain_module (shared)
slotmem_shm_module (shared)
socache_dbm_module (shared)
socache_memcache_module (shared)
socache_shmcb_module (shared)
status_module (shared)
substitute_module (shared)
suexec_module (shared)
unique_id_module (shared)
unixd_module (shared)
userdir_module (shared)
version_module (shared)
vhost_alias_module (shared)
dav_module (shared)
dav_fs_module (shared)
dav_lock_module (shared)
lua_module (shared)
mpm_prefork_module (shared)
proxy_module (shared)
lbmethod_bybusyness_module (shared)
lbmethod_byrequests_module (shared)
lbmethod_bytraffic_module (shared)
lbmethod_heartbeat_module (shared)
proxy_ajp_module (shared)
proxy_balancer_module (shared)
proxy_connect_module (shared)
proxy_express_module (shared)
proxy_fcgi_module (shared)
proxy_fdpass_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_scgi_module (shared)
proxy_wstunnel_module (shared)
ssl_module (shared)
systemd_module (shared)
cgi_module (shared)
php7_module (shared)
Does the above look correct? Should the last one, php7_module, be loaded since I am trying to run both 7.0 and 7.2?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org