Best way to make RHSCL PHP available globally

I have installed RHSCL 2 using the following url:

https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/2/html/2.0_Release_Notes/chap-Installation.html

using the RedHat subscription manager.

I then ran yum remove php* followed by yum install rh-php56

Everything went smoothly except now PHP is not found anywhere. I then ran find / -name php and found rh-php56 in the following directories:

/var/opt/rh/rh-php56/lib/php
/opt/rh/rh-php56/register.content/var/opt/rh/rh-php56/lib/php
/opt/rh/rh-php56/root/usr/bin/php
/opt/rh/rh-php56/root/usr/lib64/php
/opt/rh/rh-php56/root/usr/share/php

What is the best way to get these binaries into /usr/bin or any other directory that is usually globally available for all users?

Did I miss a step when installing the packages which is why it is not available globally? Or is this just what happens when using RHSCLs?

I have tested the binaries in those folders and they work when I run php -v so it is working fine.

My first thought is to just cp into /bin or /usr/bin but maybe there is an official way to do what I am asking?

edit

Cannot comment, no rep... from chapter 3 of the link I posted, it says that software collection packages must be run like so:

scl enable rh-php56 'php -v'

Which does work... however how do I get it to run for all users like $ php -v with no additional commands. I need the php binaries globally available so webservers can use it and ssh users with normal shells.


The way to import a software collection into your current shell (not launch a sub-shell) is to source the "enable" file.

For example for rh-php56 on a Redhat 7 machine...

source /opt/rh/rh-php56/enable

You can now run "php", or read manpages "man php" as normal.

that will add the appropriate environment variables to the current shells environment. Individual users can do this in there .bashrc files, allowing it to be available from SSH (non-interactive shells)

You can also copy (or symlink) the enable file into /etc/profile.d/ with a ".sh" suffix to automatically enable it for ALL users.

For example

ln -s /opt/rh/rh-php56/enable /etc/profile.d/rh-php56.sh

Becareful doing this if more than environment is needed (such as daemons?). Or if multiple versions of that software is present on a system (for backward compatibility with other software/services), as there may be interaction between versions. Also users may not want the 'latest' version, or become confused as to why the 'base' system (EG: /etc configs) does not effect the software collection version.

Anthony Thyssen (A very old system Admin)