This is an old revision of the document!


Litespeed Web Server New Relic Installation Guide

Notes before we begin:

  • In this example, we used the tarball installation (v4.6.5.40), not the Ubuntu/Debian nor the RedHat/CentOS installation, so the steps may be different on those installations.
  • We used PHP v5.4.25 installed by the Web Admin Console in its default directory.
  • We have LSWS installed in the default directory (/usr/local/lsws).
  • These steps assume that you have downloaded the New Relic installation package and decompressed the tarball if you chose that method.
  • If you got the installation working, but newrelic isn't recognizing any information on your web server, go to Step 3
  • If PHP was installed to a non-standard location (if you installed via the Web Console, this applies to you), then you need to do step one. If the New Relic installation still didn't work with a standard PHP installation, then you might also need to do the first step. Otherwise, you may skip it. For cPanel users, PHP is by default installed to /usr/local, which will be found by the install script.

Step 1:

There are two ways to get the installer to recognize the PHP installation. Both options are ways to get the installer to find the correct PHP installation. Please read through both and decide for yourself which is the best option.

  • Option 1:
    1. Go to the newrelic download directory and open the newrelic-install script in an editor.
    2. Go to line 460 or so, there are a bunch of paths added for the script to find the PHP installation.
    3. In a separate window, find your PHP bin path. The default for the Web Admin compilation is /usr/local/lsws/lsphp5/bin.
    4. Add the path to the script, following the format of the other paths added, and save.
      • i.e.: add_to_path /usr/local/lsws/lsphp5/bin
  • Option 2:
    1. Backup your local PHP binary if you have one:
      • /usr/local/bin/php
    2. Copy the lsphp5 binary into the local PHP binary's place. The lsphp5 binary is located in the fcgi-bin sub-directory in the lsws directory.
      • /usr/local/lsws/fcgi-bin/lsphp5
    3. Rename the lsphp5 binary to php to make the installer recognize the binary. Now, you have two copies of the same binary in the following directories with their respective names:
      • /usr/local/bin/php
      • /usr/local/lsws/fcgi-bin/lsphp5
  • After implementing one of these options, try installing New Relic via its install script. If one option doesn't work, try the other.
  • IMPORTANT: The installer may have recognized your local PHP installation and not the LSWS one. Check to make sure that it is using the same installation as LSWS to prevent any issues that may come up.

Step 2:

In the lib subdirectory of your PHP installation, look for a newrelic.ini or php.ini file.

i.e. /usr/local/lsws/lsphp5/lib

  • If it exists, you likely do not need to do this step.
  • If it doesn't:
  1. Create a php.ini file in that directory.
  2. Copy the contents of the template file in the newrelic directory. It should be located in the script subdirectory: newrelic-php5-4.6.5.40-linux/scripts/newrelic.ini.template and paste it in the newly created php.ini file.
  3. Inside the copied template, there is a section for the license. Paste your license there.
  • Note: I un-commented the commented configuration lines. I'm not sure if this is a necessary step unless you want to do custom configurations for New Relic, so you can try without changing it first if you wish.

Step 3:

If you run your web server in suEXEC Daemon Mode, then you can skip this step. If you don't, you may need to give permissions to the newrelic log directory to get it working.

  • If you need to do this step, I did:
 > cd /var/log
 > chmod 777 newrelic
  • NOTE: If you chose to enable Daemon Mode, it took a few minutes for New Relic to work for me, so try waiting a few minutes before restarting.

Step 4:

Gracefully restart the server and check the phpinfo page (default is http://[address]:8088/phpinfo.php)

  • Search for newrelic and it should be there. If not, try restarting the New Relic Daemon first. If that didn't work, try to enable Daemon Mode or grant permission to the log directory (Step 3).

Step 5:

Attempt to connect to the application on the New Relic account page, and it should be working.

  • Admin
  • Last modified: 2014/03/25 14:21
  • by Kevin Fwu