This error message is usually caused when you do not have scl-utils installed.
Try doing
yum install scl-utils
Answer from nikoo28 on Stack OverflowI had this problem as well. I don't know why scl was failing to enable the environment, but I was able to get it to load with source /opt/rh/devtoolset-7/enable.
It is because of your settings in .bashrc and/or .bash_profile. scl appends its path to gcc7 before starting your new bash shell, but the path to gcc is default to the old gcc4 again because your .bashrc appends /usr/bin to the path when starting the new bash, and it supersedes the scl settings. The solution is to use the "enable" script directly. That way no further path settings annoy you.
using scl enable actually opens a new shell inside your current one, which is quite unclean, especially if done from a login script.
You should place, instead, in your ~/.bash_profile:
source /opt/rh/rh-nginx18/enable
or:
source scl_source enable rh-nginx18
The latter is more "elegant" as it is independent from the actual installation path.
This has the effect of loading the environment in your current shell.
Redhat proposes placing a file in /etc/profile.d, i.e. for python:
$ cat /etc/profile.d/enablepython33.sh
#!/bin/bash
source scl_source enable python33
As this works for the devtools under centos for me you could try this.
It appears that the PHP 7.1 software collection is not built for CentOS 6, but is available in CentOS 7.
You could try to rebuild the rh-php71 software collection for CentOS 6, but I have not found any information that anyone has tried to do that.
You can find information about available software collections from their website or from the configured YUM repository
When looking for the correct package to install into a CentOS system, the first place I tend to look is under centos.pkgs.org. Their search comes up with mostly exhaustive results for the major .rpm repositories out there as well as instructions on how to install each package on the relevant page.
php71 rpm for CentOS 6 (remi repo)