Monitoring your application with New Relic on your hosting

There is a difference between knowing that the site is slow and knowing which line of code is slowing it down. The first is measured with a stopwatch; the second needs a tool that watches PHP from the inside, request by request. New Relic is one of those tools, and it is available on your hosting.

This is not for everyone, and there is no harm in saying so. If your site is a company website or a blog, you do not need this — the right path is the site is slow: what actually makes a difference, which solves the overwhelming majority of cases with the PHP version, caching and images. New Relic is for people who develop the application and have already done the basics.

What it shows that nothing else does

What you see What it is for
Time per request, broken down How much was PHP, how much was the database, how much was waiting on external services. It answers «where do the 3 seconds go?».
The slowest SQL queries With the time of each and how often it ran. A query called 400 times per page shows up here, and nowhere else.
The heaviest pages Ordered by total time, not by popularity — which is what matters when optimising.
Errors, with context The exception and the path that led to it. It complements the PHP error log, which gives the line but not the journey.

Before you start

1 Create an account at newrelic.com. It is a third-party service, with a free plan that is plenty for one site.
2 Generate a licence key (the INGEST — LICENSE type) and keep it.
3 Check your PHP version. The extension exists for the 8 series — see viewing and adjusting your PHP configuration. If the site still runs an old version, that is the change to make first, and on its own you will already notice it.

Enabling the extension

1 In cPanel, open the PHP Selector and go to the extensions tab.
2 Find newrelic in the list and switch it on.
3 Save. It takes a couple of minutes to become active.

Telling it which account is yours

With the extension enabled it still sends nothing: the key and the application name are missing. Two directives:

newrelic.license = "YOUR LICENCE KEY"
newrelic.appname = "My Site"
1 In cPanel, open the MultiPHP INI Editor and choose the direct-edit mode.
2 Pick the domain, add the two lines and save.
3 Confirm with phpinfo() — look for the newrelic section and check the values are there. Without that confirmation you do not know whether it took, and you will spend half an hour staring at an empty dashboard.
Do not follow the guides that tell you to put this in .htaccess. Many tutorials show php_value newrelic.license inside .htaccess. Depending on how PHP is running, those lines may be simply ignored — and they throw no error saying so. The reliable route is the panel's editor, and the proof is always phpinfo(). For how to change these values, see PHP limits.

Once it is running

Data starts appearing in the New Relic dashboard a few minutes after the first visitor. If it is still empty after half an hour, the causes are nearly always three: the key is wrong, the directives did not take (phpinfo() will say), or the site simply has not had any visits yet.

The application name matters more than it looks. If you have several sites on the same account and give them the same newrelic.appname, all their data appears mixed into one graph — and the diagnosis becomes useless. A different name per site, from the start.

What is ours and what is theirs

We provide the extension and the server it runs on: if the extension does not appear in the list, or the directives will not take, that is ours to fix. The account, the pricing, the dashboards and reading the data are New Relic's — we do not support the tool itself, and their documentation is good. Where our support ends is in how far our support goes.

If all you want is to understand the account's consumption — processor, memory, input and output — you already have that in the panel, with nothing to install: how to monitor your site performance in cPanel. And the other languages available here are in which technologies run here.

Want New Relic enabled and cannot find the extension?

Talk to us

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $15.00/mo

See plans
  • 0 Users Found This Useful
Was this answer helpful?