[CentOS] Wrong version of php

Tue Jun 23 22:03:09 UTC 2020
H <agents at meddatainc.com>

On 06/23/2020 04:07 PM, Leon Fauster via CentOS wrote:
> Am 23.06.20 um 17:35 schrieb H:
>> 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/centos
>>
>> I 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
>
>
> I do not known what exactly you are trying but
> for scripts you could pass the php binary with
> full path or use a shebang like
>
> #!/opt/rh/rh-php72/root/usr/bin/php
>
> -- 
> Leon
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos

Fixed, I realized I can specify the php executable in the systemd unit.