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.

SetEnv doesn't appear in php info

Discussion in 'EasyApache' started by Yukinarija, Nov 7, 2016.

  1. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Hey,

    I've been setting up NewRelic for myself based on this little guide that I found here: blog.rac.me.uk/2013/05/29/new-relic-cpanel-apache-and-fastcgi-php/

    Long story short, we setup SetEnv in httpd.conf with every VHost.
    Then, that variable should be used in php.ini.

    Problem is, I tried fastcgi, suphp with both suexec on/off, but the variable I set with SetEnv doesn't appear in php info, or _SERVER or _ENV dumps.

    I am a bit lost on how to debug it next, maybe somebody has any ideas?
    Example VHost:

    Code:
    <VirtualHost 123.123.123.123:80>
    ServerName example.com
    SetEnv pokemon example.com

    Searching phpinfo, for 'pokemon' yields no results with whatever php config I tried.
    Thank you.
     
    #1 Yukinarija, Nov 7, 2016
    Last edited by a moderator: Nov 9, 2016
  2. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Found that it doesn't work if .php files are accessed via https. Works via http. Investigating further.
     
  3. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    599
    Likes Received:
    90
    Trophy Points:
    103
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi,

    Note that each virtualhost in Apache will have a :80 vhost and an :443 vhost. Make sure you made changes to those vhosts in both areas. That should get it working for :443 for you.

    I hope this helps!
     
  4. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Haha Jacob! TYVM! Just noticed that myself and came back here to reply - to leave a solution, hahaha... ! Have a nice day and thanks for replying!
     
    cPJacob likes this.
  5. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Jacob - sorry to ask you again, but I figured that maybe you could give my tired head today an another idea.

    Basically, in php.ini ->
    newrelic.appname = "${newrelic_appname}"

    With suPHP (and above) - it works fine.
    with fastCGI (and above) - variable is empty.

    I suppose this is because fastCGI starts with a clean enviroment when an app is ran? (To confirm this, I suppose I should switch the server back between and see if i can print _SERVER or _ENV variables, though I can't do that now, since it's being used.)

    I looked into Apache's mod_fcgid and found 'FcgidInitialEnv', which I used just below 'SetEnv' in the virtualhost config.

    Though, - php.ini still doesn't pickup the variable? Any thoughts on this? I do my best to test it out properly tomorrow to understand the inner workings (as I am still lacking quite a bit of knowledge). Thought that maybe you'd know. TYVM and have a great evening.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,163
    Likes Received:
    1,294
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  7. Yukinarija

    Yukinarija Member

    Joined:
    Nov 2, 2016
    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Thanks! I am actually still using EA3 on this one, but I will switch over to EA4 as a test. Too bad about HTTP2 support.

    Edit: Setting .user.ini for CGI/FastCGI SAPI in public_html of the user seemed to work for fastCGI. So in the end to include NewRelic with fastCGI - I did:

    1) Install NewRelic, with 'all'
    2) Tweak templates, to include 'SetEnv'
    3) Use that variable, via .user.ini ( newrelic.appname = ${newrelic_appname} )

    Since I need this for all domains, I will probably look for an another solution, though as a 'selectable' choice - it's pretty decent I suppose.

    If anybody has any idea, how could I make FastCGI react to my global php.ini (with the same newrelic.appname = ${newrelic_appname} ) - I really appreciate it. Though it's missing the variable there, and 'FcgidInitialEnv' doesn't help.
     
    #7 Yukinarija, Nov 9, 2016
    Last edited: Nov 9, 2016
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    Thank you for the clarification. While PHP-FPM is supported in EasyApache 4, I wanted to note that support for mod_fcgid is not yet available. It's planned for cPanel version 62:

    EasyApache 4 mod_fcgid

    Regarding the PHP values in EasyApache 3 when using FCGI, what shows up under loaded configuration files when opening a PHPINFO file under the document root?

    Thank you.
     
Loading...

Share This Page