Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
litespeed_wiki:php:new_relic [2017/04/21 12:59]
Michael Alegre Removed example hyperlink.
litespeed_wiki:php:new_relic [2020/12/01 04:11]
Eric Leu
Line 1: Line 1:
 ==== Litespeed Web Server New Relic Installation Guide(PHP Monitoring) ==== ==== Litespeed Web Server New Relic Installation Guide(PHP Monitoring) ====
- 
-=== 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 [[litespeed_wiki:​php:​new_relic#​Step_3|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: === === 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.//+PHP agent installation
  
-  ​* Option 1+  ​- Red Hat/CentOS
-    Go to the newrelic download directory and open the ''​newrelic-install''​ script in an editor. +``` 
-    Go to line 460 or so, there are a bunch of paths added for the script to find the PHP installation. +yum install newrelic-php5 
-    - In a separate window, find your PHP bin path.  The default for the Web Admin compilation is ''/usr/local/lsws/lsphp5/​bin''​. +sudo newrelic-install ​install 
-    ​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''​ +  ​Debian/​Ubuntu:​ 
-  * Option 2: +``` 
-    Backup your local PHP binary if you have one: +echo 'deb http://apt.newrelic.com/debiannewrelic non-free' ​| sudo tee /etc/apt/sources.list.d/newrelic.list 
-      * ''​/usr/local/bin/​php''​ +wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add 
-    - 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. +sudo apt-get update 
-      * ''/​usr/​local/​lsws/​fcgi-bin/​lsphp5''​ +sudo apt-get install newrelic-php5 
-    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: +sudo newrelic-install ​install 
-      * ''/​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: ===  +Configure ​your application name and New Relic license key. 
-In the lib subdirectory of your PHP installation, look for a newrelic.ini or php.ini file.+The installation ​process prompts ​for your application name and license keyYour license key appears in the account information section of Account settings.
  
-i.e. ''/​usr/​local/​lsws/​lsphp5/​lib''​ +=== Step 2: === 
-  * If it exists, you likely do not need to do this step. +Restart your web server and PHP service 
-  * If it doesn'​t:​ +``` 
-  - Create a ''​php.ini''​ file in that directory. +systemctl restart lsws 
-  - 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. +killall lsphp 
-  - 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: ===  === Step 3: === 
-If you run your web server in [[http://​www.litespeedtech.com/​products/​litespeed-sapi/​php/​suexec-daemon-mode|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. +Visit any PHP page to generate some traffic
-  * If you need to do this step, I did: +
-<​code>​ > cd /var/log +
- > chmod 777 newrelic +
-</​code>​ +
-  * 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: ===  === Step 4: === 
-Gracefully restart ​the server and check the phpinfo ​page (default is ''<​nowiki>​http://​[address]:​8088/​phpinfo.php</​nowiki>''​) +Attempt to connect to the application on the New Relic account ​pageand it should be working.
-  * 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 ([[litespeed_wiki:​php:​new_relic#​step_3|Step 3]]) +
  
-=== Step 5: ===  
-Attempt to connect to the application on the New Relic account page, and it should be working. 
  • Admin
  • Last modified: 2020/12/01 04:30
  • by Eric Leu