Howto Install New Relic on Localhost

I’m sure you’ve all used or at least heard of New Relic application monitoring tool. If you haven’t, you’ve been living in a cave for the last couple of years 🙂 It’s a great tool for pinpointing bottlenecks in your application. However, most people have this tool installed on their production systems only. What if you are developing on your localhost and would like to detect potential weaknesses in your application before you deploy the code to staging and production? Well, you can install New Relic on localhost the same way you do on remote servers.

Install New Relic on Localhost

I do majority of my development in PHP and Ruby, but for the purpose of this blog post, I’m going to install New Relic PHP agent on OS X. To install New relic on Localhost follow these steps:

  • Download the latest PHP agent from the New Relic website and extract the files.
  • Write down your php executable path. Typically, this is going to be /usr/bin. You can find out what this path is by typing in which php in your terminal window.
  • cd into your New Relic agent directory you just extracted and type in:
    sudo NR_INSTALL_PHPLIST='<your php path>' ./newrelic-install
  • Follow instructions during the installation
  • (optional) I normally then edit my php.ini file and change the New Relic application name from
    newrelic.appname = "PHP Application"

    to

    newrelic.appname = "Dev - Marko"

    That way if there are other developers running the same agent you’ll all have your own application to monitor.

  • Restart your services such as: nginx, php-fpm or apache.

Now all you need to do is log into your New Relic dashboard and your application should appear within seconds.

Marko