Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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,888
    Likes Received:
    89
    Trophy Points:
    78
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,809
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice