Is there a way that I can permanently enable a SCL?

I've installed rh-php56, and I would like to make sure that it is loaded every time I ssh into my machine.

I am currently running CentOS 7.

3 Answers 3


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


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.

  • this also works on amazon linux Linux ip-10-1-129-214 4.14.238-125.422.amzn1.x86_64 #1 SMP Tue Jul 20 20:51:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
    – retgoat
    Feb 23, 2022 at 5:45

Redhat proposes placing a file in /etc/profile.d, i.e. for python:

$ cat /etc/profile.d/enablepython33.sh
source scl_source enable python33

As this works for the devtools under centos for me you could try this.

  • 3
    This is what I do. I've created an /etc/profile.d/scl_enable.sh file with all of my scl files in that one file. Sep 26, 2018 at 13:31

I think you could add a line into your shell profile (e.g. ~/.bash_profile) to enable your scl of choice. For example,

scl enable rh-nginx18 bash

EDIT: marked as spoiler since this is dangerous

Reload your profile or logout/login, and you should have access to your SCLs.

  • 8
    One problem with this is that your resulting bash is no longer a login shell. And you can't make it a login shell. If you try, you'll fork bomb your system. This may work in some circumstances, but it's not the recommended method. Jan 10, 2018 at 2:59
  • 4
    CAREFUL! Adding an scl command like the above just got me a "frozen" login because the script got stuck for some reason. Have this page for a handy reference for when you get locked out: serverfault.com/questions/94503/…
    – Lance Kind
    Aug 22, 2019 at 21:33
  • 1
    The accepted response is DANGEROUS, and should be somehow demoted or removed. Adding this so maybe people will notice it before forkbombing themselves :)
    – Dan Vatca
    Dec 4, 2019 at 8:14
  • This fork bombed me and should be instantly removed. Dec 2, 2020 at 22:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .