Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to set up NewRelic on my Apache2/PHP server, and have it report different applications per vhost. To do this, the php value newrelic.appname must be changed. It is defined by default in /etc/php.d/newrelic.ini however to do per vhost reporting, it needs to be set specifically on that vhost, as described here: https://newrelic.com/docs/php/per-directory-settings

In my /etc/php.d/newrelic.ini is set:

newrelic.appname="PHP Application;MySite.com;"

In my vhost I have the following configuration:

<Directory "/">
    AllowOverride All
    php_value newrelic.appname "MySite.com"
</Directory>

And it my .htaccess I have:

php_value newrelic.appname 'MySite.com'

But looking at phpinfo() served from a file in the same directory as the .htaccess file I get:

 Directive Name     Local/Active Value  Master/Default Value
 -----------------------------------------------------------
 newrelic.appname   PHP Application     PHP Application

Using FastCGI via spawn-fcgi.

Any other suggestions would be much appreciated.

share|improve this question
    
Are you running PHP as Apache module, or maybe as CGI/FastCGI application ? –  pdaukintis Feb 27 '13 at 21:10
    
Oops, I meant to include that in the post - I am using FastCGI. –  doublesharp Feb 28 '13 at 3:32
    
I happen to be using WordPress for most of my sites, so I am usin ini_set('newrelic.appname', 'MySite.com') in the wp-config.php file to more or less make this work, but I'm still not sure how to set php values in config using PHP/FastCGI. –  doublesharp Feb 28 '13 at 22:34
    
.htaccess is an Apache thing. When you're using Apache's mod_php, it'd work, but FastCGI isn't hooked into Apache. –  ceejayoz Mar 1 '13 at 21:33

1 Answer 1

up vote 6 down vote accepted

If you want to use .htaccess configuration files while using PHP as CGI/FastCGI, you could use htscanner PHP module, which can parse existing and new .htaccess configuration files with various options (including php_value).

UPDATE: Answer is outdated. See below for updated answer:

Since PHP 5.3.0 PHP includes support for configuration INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.

share|improve this answer
    
Sweet, thanks, this does exactly what I wanted. –  doublesharp Mar 2 '13 at 0:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.