Yukinarija

Member
Nov 2, 2016
18
1
3
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.
 
Last edited by a moderator:

JacobPerkins

Well-Known Member
May 2, 2014
617
97
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!
 

Yukinarija

Member
Nov 2, 2016
18
1
3
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.
 

Yukinarija

Member
Nov 2, 2016
18
1
3
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.
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
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.
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.