How to Find WordPress Performance Bottlenecks with New Relic on LiteSpeed/CyberPanel

New Relic APM can help you find WordPress Performance Bottlenecks by digging deep into internals of WordPress. You can easily find poorly performing plugins, themes, database queries or even external calls. Without New Relic APM all you are doing is a guess work by activating/deactivate plugins and or changing themes.

Before moving forward, if you site is new with no traffic and you still want to test its performance you can use CyberLoader to put stress on your site and use New Relic to find performance issues.

However, setting up New Relic can be hard at times specially for people with no command line knowledge. There are many online tutorials that helps you configure New Relic with Apache or NGINX but there are close to none on how you can set it up with optimized LSPHP that CyberPanel usually ships with.

Note: If you are still not using CyberPanel, then you are missing out. Start using CyberPanel and see how easy it is to give performance boost to your WordPress site for free.

1) Get your self a account on New Relic Site

The first step in setting up New Relic on your server is to get an account on New Relic site you if don’t have one. If you already have an account, you can move forward.

2) Configure your server in New Relic APM

We need to configure our server so that it can send data to New Relic APM dashboard. Once logged into dashboard click APM from the menu and then click Add More Data.

You will then see a window where you have multiple options to configure and install New Relic daemon on your server, we will be using the Guided Install method.

After selecting Guided Install Option you need to choose what kind of monitoring you are going to do. Since WordPress is an app, we will select App Monitoring.

Since WordPress is a PHP application, we will choose PHP.

3) Add you PHP Application Data

You first need to give a unique name to the application, this is important so make sure this is a unique name. And then you have to choose your installation environment, we are going to perform this on Ubuntu, however, it will be similar for Centos as well.

So for Ubuntu select apt from the agent list.

Once you select apt from the list, you will be shown some commands. Don’t run all the commands, because with LSPHP the process is different.

So open your server terminal and run these commands

1. echo 'deb newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list
2. wget -O- | sudo apt-key add -
3. sudo apt-get update
4. sudo apt-get -y install newrelic-php5

Note : Before running the fifth command, you need to set an environment variable, so that New Relic knows where to install the module.

Setup environmental variable

We need to tell path of PHP Binary to New Relic before actually installing it, run:

export NR_INSTALL_PATH=/usr/local/lsws/lsphp74/bin

I am installing New Relic for PHP 7.4 so my NR_INSTALL_PATH value is /usr/local/lsws/lsphp74/bin, if you want to install for PHP 7.3 it will be /usr/local/lsws/lsphp73/bin and similarly for other PHP versions

Once environment variable is set run the modified version of 5th command:


After running this command New Relic is Installed on your system for PHP 7.4

Then Run last command

sed -i -e "s/REPLACE_WITH_REAL_KEY/a07ab8db0feaf2e017df859c1a20df08cc74NRAL/" \
-e "s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\"${NEWRELIC_APP_NAME}\"/" \
-e '$anewrelic.distributed_tracing_enabled=true' \
$(php -r "echo(PHP_CONFIG_FILE_SCAN_DIR);")/newrelic.ini

Now make sure that your newrelic.appname is properly set in newrelic.ini, open /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/newrelic.ini

Find and set the value of newrelic.appname according to what you have set in Step 3.

Restart your Application

Restart LiteSpeed and LSPHP to make sure that New Relic Extension is loaded.

systemctl restart lsws
killall lsphp

You can create a php info page to make sure that New Relic Extension is loaded.

See your data

Once all of the above is done, you need to visit your site and generate some data and then click “See your data” and you will able to see data coming from your server.

4. Find WordPress Performance Bottlenecks

Now that everything is setup you can use New Relic APM dashboard to find various pain points in your WordPress.


This guide works just fine, but here’s another guide with some extra details.
Installing and Configuring New Relic for WordPress | GridPane