The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to setup environment variables

Discussion in 'Workarounds and Optimization' started by dimkasta, Jul 8, 2017.

  1. dimkasta

    dimkasta Registered

    Joined:
    Aug 14, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    I am setting up a symfony 3 application, and I need to setup a few environmental variables.

    I tried adding them in a profile.d script. This made them available on SSH shell, but php still cannot get them

    I am running Centos 7.3 and WHM/cpanel 64.0, while easy apache is set with php 7.1.3 and php-fpm

    Thanks in advance for your time
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,407
    Likes Received:
    53
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    Try the below:

    # cd ~
    # touch .bash_exports
    # vi .bash_exports
    Put your environmental variables in here..

    # vi .bashrc
    Add the below bold statement in the .bashrc file.
    if [ -f $HOME/.bash_exports ]; then
    . $HOME/.bash_exports
    fi
     
  3. dimkasta

    dimkasta Registered

    Joined:
    Aug 14, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Thanks for the response

    I have already tried this but unfortunately, it does not work.
    .bashrc is executed when you start bash as a user, so you will have those when using SSH for example.
    But apache and php-fpm still have no way of knowing those variables.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,086
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you provide some more information about the specific environmental variables you need to configure? There's a thread here you may find helpful:

    How to use php-cli 7.X instead 5.6

    Thank you.
     
Loading...

Share This Page