Plesk 12.5 allow for multiple PHP versions and integration methods. This is a great feature but it makes installing New Relic more difficult. New Relic by default installs to the Linux distribution’s version of PHP. With Plesk 12.5, there are multiple PHP versions in different locations. Also New Relic uses a unix socket to facilitate communication between the newrelic-daemon and the PHP component. When running PHP under php-fpm there are permission problems with multiple sites using New Relic. Here are the steps to get New Relic working on CentOS or RedHat. Other Linux distributions will be similar.
1. Install New Relic for the operating system following the standard instructions:
https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-overview
2. Set the newrelic-daemon to run independently by copying the config file template:
1 |
cp /etc/newrelic/newrelic.cfg.template /etc/newrelic/newrelic.cfg |
3. Configure the newrelic-daemon to listen on a TCP port instead of a UNIX socket:
1 |
echo "port=21111" >> /etc/newrelic/newrelic.cfg |
4. Start the newrelic-daemon:
1 |
service newrelic-daemon restart |
5. Configure distribution provided PHP to use newrelic-daemon:
1 |
echo "newrelic.daemon.port=21111" >> /etc/php.d/newrelic.ini |
6. Restart Apache
1 |
service httpd restart |
7. Install New Relic on Plesk provided PHP installations using the instructions here:
https://docs.newrelic.com/docs/agents/php-agent/advanced-installation/php-agent-installation-non-standard-php-advanced
We’ll start with PHP 5.6:
1 2 |
NR_INSTALL_PATH=/opt/plesk/php/5.6/bin; export NR_INSTALL_PATH newrelic-install |
8. Set the TCP port
1 |
echo "newrelic.daemon.port=21111" >> /opt/plesk/php/5.6/etc/php.d/newrelic.ini |
9. Restart cooresponding php-fpm process:
1 |
service plesk-php56-fpm restart |
10. Repeat steps 7, 8 and 9 for each additional PHP version installed on the server.