Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Relic Solution: Why do I have a 20-newrelic.ini?


#1

Ubuntu/Debian systems have a script, /usr/sbin/phpenmod, which will create a symlink from mods-available to the sapi’s conf.d folder to “enable” installed PHP modules:

root@earl:~# ls -l /etc/php/7.1/apache2/conf.d/20-newrelic.ini
ls: cannot access '/etc/php/7.1/apache2/conf.d/20-newrelic.ini': No such file or directory

root@earl:~# /usr/sbin/phpenmod -v ALL newrelic

root@earl:~# ls -l /etc/php/7.1/apache2/conf.d/20-newrelic.ini
lrwxrwxrwx 1 root root 40 Nov 1 15:03 /etc/php/7.1/apache2/conf.d/20-newrelic.ini -> /etc/php/7.1/mods-available/newrelic.ini

You can use /usr/sbin/phpdismod similarly to disable PHP modules including New Relic. Both can be passed a PHP version and SAPI to enable/disable modules for only specific PHP versions. The following would disable New Relic for just PHP 7.1 and Apache leaving it enabled for command line:

usage: phpdismod [ -v ALL|php_version ] [ -s ALL|sapi_name ] module_name [ module_name_2 ]

root@earl:~# /usr/sbin/phpdismod -v 7.1 -s apache2 newrelic

This can create duplicate config files causing confusion. If we install a newrelic.ini to the Apache conf.d directory, phpenmod will add a 20-newrelic.ini:

root@earl:~# ls -l /etc/php/7.1/apache2/conf.d/*newrelic.ini

lrwxrwxrwx 1 root root 40 Nov 28 14:24 /etc/php/7.1/apache2/conf.d/20-newrelic.ini -> /etc/php/7.1/mods-available/newrelic.ini
-rw-r--r-- 1 root root 35578 Nov 2 09:06 /etc/php/7.1/apache2/conf.d/newrelic.ini

While these duplicate config files won’t cause any issues, modifying one of the above files could be overwritten by the other which makes updating New Relic settings confusing. To manage the New Relic module with phpenmod/phpdismod, remove the newrelic.ini from the conf.d directories and use the “mods-available” file for your PHP version such as /etc/php/7.1/mods-available/newrelic.ini. Using phpdismod will not remove the physical newrelic.ini files.