On 02/13/2021 09:43 PM, Jonathan Billings wrote:> On Feb 13, 2021, at 17:43, H <agents at meddatainc.com> wrote: >> But apache does not have a shell where I issue that command? And, a change needs to survive a reboot. > Perhaps it might help if you explained how the Apache user is running the commands? Cron job? Systemd service? The ?scl? commands are used to run the alternative PHP, so how you run it is important. > > ? > Jonathan Billings > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centosI have two situations I believe: The first is apache launching cron jobs and an hour or so I remedied the issue by explicitly specifying the location of the php 7.2 binary in the cronedit file. This now works. The second is that I am having problems with the webapp not being able to retrieve e-mail from an external e-mail account. I can view sent e-mails in the external e-mail account from the webapp (which I believe uses php smtp module) but am unable to retrieve inbox/draft/archive e-mails which require imap ssl and thus port 993. I am still trying to figure out why this is and if the webapp might kick off a php script doing this (rather than just running code in the app itself). But my question is also a more general one: short of ridding the system of the old, default php 5 binary, how should I configure a user without a shell such as apache to default to the newer php binary? As mentioned previously, apache itself runs the new php just fine (except for the imap issue above which could also be some other bug...). Also, as mentioned before, all users with a shell on this system already default to the new php binary so it is only users without shells that I have to figure out how to configure. I would appreciate your thoughts.
Kenneth Porter
2021-Feb-14 17:51 UTC
[CentOS] Changing command line version of php for apache
--On Saturday, February 13, 2021 9:59 PM -0500 H <agents at meddatainc.com> wrote:> But my question is also a more general one: short of ridding the system > of the old, default php 5 binary, how should I configure a user without a > shell such as apache to default to the newer php binary? As mentioned > previously, apache itself runs the new php just fine (except for the imap > issue above which could also be some other bug...).CentOS 7 runs apache from systemd. Apache finds programs using the path. So you need to customize the systemd unit file for Apache to run it from within a script that first prefixes the path with the location of your custom PHP binary. Software Collections provides a script for this. See the systemd documentation for how to customize a unit file. You probably just need a "drop-in" in /etc/systemd/system that replaces the ExecStart value in httpd.service. Another approach is to run php-fpm for your custom PHP (package rh-php72-php-fpm) and have Apache connect to this via the SetHandler directive. Use SetHandler instead of ProxyPass because the latter doesn't play well with FilesMatch. # send PHP requests to PHP 7.2 via php-fpm service <FilesMatch \.php$> SetHandler "proxy:fcgi://127.0.0.1:9000" </FilesMatch> This will sandbox PHP into its own process.