It's been a while since I updated to php72 on this machine and there is some setting I must have forgotten. Apache, root and a user automatically get php72 when I run php in a terminal window, however, a php script picks up the wrong version of php, ie php54 and the version of php in /usr/bin/php is indeed version 5.4. I have googled without finding the answer but how do I make sure /all/ processes use php72 rather than the default 54 in CentOS 7? Surely there must be a better way than overwriting /usr/bin/php. What have I forgotten to do? Thank you.
On 6/22/20 3:27 PM, H wrote:> It's been a while since I updated to php72 on this machine and there is some setting I must have forgotten. Apache, root and a user automatically get php72 when I run php in a terminal window, however, a php script picks up the wrong version of php, ie php54 and the version of php in /usr/bin/php is indeed version 5.4. >I would find out which package it indeed belongs to: rpm -qf /usr/bin/php I would also find out the name or package that brings PHP 7.2, like: rpm -qa | grep php and then list all files in that package, say, if it is php-7.2, then rpm -ql php-7.2 | less You will see the mame of executable to invoke php72, in the list above could be something like /usr/bin/php72 Note, I do not run php on Linux anymore, but the above are educated guesses how multiple concurrent packages layed out to not interfere with each other. Valeri> I have googled without finding the answer but how do I make sure /all/ processes use php72 rather than the default 54 in CentOS 7? Surely there must be a better way than overwriting /usr/bin/php. What have I forgotten to do? > > Thank you. > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >-- ++++++++++++++++++++++++++++++++++++++++ Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ++++++++++++++++++++++++++++++++++++++++
> I have googled without finding the answer but how do I make sure > /all/ processes use php72 rather than the default 54 in CentOS 7? > Surely there must be a better way than overwriting /usr/bin/php. What > have I forgotten to do? >You can't/shouldn't do that. The point of the Enterprise OS is that versions are consistent throughout the lifetime of the OS, so packages don't change the default versions because things may break because something is expecting PHP 5.4 and not 7.2. If you have an application that needs PHP 7.2, then change the way it is invoked so it runs using 'php72' instead of just 'php'. Now, in all honesty I suspect that changing the default version of PHP isn't going to break many things at the system level; at least not in the same way as it would if you changed the default python to python3. But it is something that may save you problems in the future. P.
On 06/22/2020 05:21 PM, Pete Biggs wrote:>> I have googled without finding the answer but how do I make sure >> /all/ processes use php72 rather than the default 54 in CentOS 7? >> Surely there must be a better way than overwriting /usr/bin/php. What >> have I forgotten to do? >> > You can't/shouldn't do that. The point of the Enterprise OS is that > versions are consistent throughout the lifetime of the OS, so packages > don't change the default versions because things may break because > something is expecting PHP 5.4 and not 7.2. > > If you have an application that needs PHP 7.2, then change the way it > is invoked so it runs using 'php72' instead of just 'php'. > > Now, in all honesty I suspect that changing the default version of PHP > isn't going to break many things at the system level; at least not in > the same way as it would if you changed the default python to python3. > But it is something that may save you problems in the future. > > P. > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centosMy thought exactly, however, I believe I made at least some of the changes required for new terminal sessions to use php72 rather than the default php54 but for some reason this script uses php54. The script starts: #!/usr/bin/env php I know I can always change this to use the already installed php72 but there must be some other change I forgot to make on my system??
Am 22.06.20 um 22:27 schrieb H:> It's been a while since I updated to php72 on this machine and there is some setting I must have forgotten. Apache, root and a user automatically get php72 when I run php in a terminal window, however, a php script picks up the wrong version of php, ie php54 and the version of php in /usr/bin/php is indeed version 5.4. > > I have googled without finding the answer but how do I make sure /all/ processes use php72 rather than the default 54 in CentOS 7? Surely there must be a better way than overwriting /usr/bin/php. What have I forgotten to do? > > Thank you.If you want it in the terminal with php72 then switch to that context with (temporarily for this session): scl enable rh-php72 bash if I am syntactically wrong about the collection name check it with scl --list -- Leon
On 2020-06-23 04:23, Leon Fauster via CentOS wrote:> Am 22.06.20 um 22:27 schrieb H: >> It's been a while since I updated to php72 on this machine and there >> is some setting I must have forgotten. Apache, root and a user >> automatically get php72 when I run php in a terminal window, however, >> a php script picks up the wrong version of php, ie php54 and the >> version of php in /usr/bin/php is indeed version 5.4. >> >> I have googled without finding the answer but how do I make sure /all/ >> processes use php72 rather than the default 54 in CentOS 7? Surely >> there must be a better way than overwriting /usr/bin/php. What have I >> forgotten to do? >> >> Thank you. > > > If you want it in the terminal with php72 then switch to that context > with (temporarily for this session): > > scl enable rh-php72 bash > > > if I am syntactically wrong about the collection name check it with > > scl --list >Thanks Leon! As usually I can tell myself: you learn something every day. Valeri> > -- > Leon > > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos-- ++++++++++++++++++++++++++++++++++++++++ Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ++++++++++++++++++++++++++++++++++++++++
On 06/23/2020 05:23 AM, Leon Fauster via CentOS wrote:> Am 22.06.20 um 22:27 schrieb H: >> It's been a while since I updated to php72 on this machine and there is some setting I must have forgotten. Apache, root and a user automatically get php72 when I run php in a terminal window, however, a php script picks up the wrong version of php, ie php54 and the version of php in /usr/bin/php is indeed version 5.4. >> >> I have googled without finding the answer but how do I make sure /all/ processes use php72 rather than the default 54 in CentOS 7? Surely there must be a better way than overwriting /usr/bin/php. What have I forgotten to do? >> >> Thank you. > > > If you want it in the terminal with php72 then switch to that context with (temporarily for this session): > > scl enable rh-php72 bash > > > if I am syntactically wrong about the collection name check it with > > scl --list > > > -- > Leon > > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centosI have that already but that only applies to new terminal sessions. The current issue is that systemd does not seem to pick up a global configuration of using php72 rather than the default php54. See https://access.redhat.com/solutions/527703