#! /bin/sh # # Copyright 2020 New Relic Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # # New Relic agent installation script. # : ${nrversion:="UNSET"} # # This must run as root. # myuid=`id -u 2>/dev/null` if [ "${myuid}" != "0" ]; then echo "ERROR: $0 must be run as root" >&2 exit 1 fi if [ -n "${NR_INSTALL_SHELL}" -a -z "${NR_KSH_EXECED}" ]; then [ -x "${NR_INSTALL_SHELL}" ] && NR_KSH_EXECED=1 exec "${NR_INSTALL_SHELL}" -c $0 "$@" fi if [ -n "${BASH_VERSION}" ]; then case $BASH_VERSION in [3456789].* ) NR_KSH_EXECED=1 ;; esac fi if [ -z "${NR_INSTALL_NOKSH}" -a -z "${NR_KSH_EXECED}" ]; then [ -x /bin/bash ] && NR_KSH_EXECED=1 exec /bin/bash $0 "$@" [ -x /usr/bin/bash ] && NR_KSH_EXECED=1 exec /usr/bin/bash $0 "$@" [ -x /bin/ksh ] && NR_KSH_EXECED=1 exec /bin/ksh $0 "$@" [ -x /usr/bin/ksh ] && NR_KSH_EXECED=1 exec /usr/bin/ksh $0 "$@" fi LANG= nl=' ' # # Determine how to suppress newlines in echo statements. # if echo ' \c' | grep 'c' > /dev/null 2>&1; then en='-n' ec= else en= ec='\c' fi # # Important: if this script is being invoked on a system where a package # manager such as rpm or dpkg did the installation, the script lives in the # shared scripts directory, and is exec'ed from that location by a front-end # script in /usr/bin. If invoked directly out of a tar distribution it will # not have been execed this way and we need to look in the current location # for the scripts and agents directories. In the first case (rpm etc) the # front end script will have set the NR_INSTALL_LOCATION environment variable # to point to the installed location. If this variable is not set, we need # to compute it later on. However, we always keep a variable called ispkg # set to a non-empty string if we were invoked by the front-end script. # Thus, in the code below, please be aware that this is what ispkg means. # ispkg= [ -n "${NR_INSTALL_LOCATION}" ] && ispkg=1 imode= if [ -n "$1" ]; then [ "$1" = "install" ] && imode=$1 [ "$1" = "install_daemon" ] && imode=$1 [ "$1" = "uninstall" ] && imode=$1 [ "$1" = "purge" ] && imode=$1 fi if [ -n "${NR_INSTALL_SILENT}" ]; then if [ -z "$imode" ]; then echo "ERROR: must invoke with either 'install', 'install_daemon' or 'uninstall' in silent mode." >&2 exit 1 fi fi # # Set up the logging environment. # nritemp=`date +%Y%m%d-%H%M%S 2> /dev/null` nritemp="${nritemp}-$$" nrilog=/tmp/nrinstall-${nritemp}.log nrsysinfo=/tmp/nrinstall-${nritemp}.sysinfo logtar=/tmp/nrinstall-${nritemp}.tar now=`date 2>/dev/null` # # Clean up any existing files. # rm -f $nrilog $nrsysinfo $logtar > /dev/null 2>&1 # # Create the log file. # echo "New Relic Agent Install Log dated: $now" > $nrilog # # And the sysinfo file. # echo "New Relic Agent Install sysinfo dated: $now" > $nrsysinfo # # Set up enough of the error handling environment so we can error out # in the event we don't support the O/S we're on. # error() { echo "ERROR: $@" >> $nrilog echo "ERROR: $@" >&2 } # # Get the OS type. # ostype= if [ -f /etc/redhat-release -o -f /etc/redhat_version ]; then ostype=rhel elif [ -f /etc/os-release ] && grep -q -i 'Debian' /etc/os-release; then ostype=debian elif [ -f /etc/alpine-release ] || [ -d /etc/apk ]; then ostype=alpine elif [ -f /etc/release ]; then if grep Solaris /etc/release > /dev/null 2>&1; then ostype=solaris fi fi if [ -z "${ostype}" ]; then tus=`uname -s 2> /dev/null` case "${tus}" in [Dd][Aa][Rr][Ww][Ii][Nn]) ostype=unsupported_os ;; [Ff][Rr][Ee][Ee][Bb][Ss][Dd]) ostype=unsupported_os ;; [Ss][Uu][Nn][Oo][Ss]) ostype=unsupported_os ;; [Ss][Mm][Aa][Rr][Tt][Oo][Ss]) ostype=unsupported_os ;; esac fi : ${ostype:=generic} # # Bail out if we don't support the operating system we are on. # # If New Relic doesn't release anything for the O/S we are on, # the only reason why we would have gotten here is if the user # unpacked a tarball on an unsupported O/S # and then attempted to run this shell script. # if [ "${ostype}" = "unsupported_os" ] ; then msg=$( cat << EOF Your operating system is not supported by the New Relic PHP agent. If you have any questions or believe you reached this message in error, please file a ticket with New Relic support. Please visit: https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/ to view compatibilty requirements for the the New Relic PHP agent. The install will now exit. EOF ) error "${msg}" exit 1 fi # # We need to determine where we were invoked from. We use this to calculate our # default paths for where we look for things. This makes the whole New Relic # package relocatable. # : ${PATH_SEPARATOR:=':'} if [ -z "${ispkg}" ]; then myloc= case "$0" in */*) myloc=$0 ;; *) oIFS=$IFS IFS=$PATH_SEPARATOR for d in $PATH; do IFS="${oIFS}" [ -z "$d" ] && d="." [ -r "$d/$0" ] && { myloc="$d/$0" break } done IFS="${oIFS}" ;; esac [ -z "${myloc}" ] && myloc=$0 if [ -z "${myloc}" ]; then echo "ERROR: existential crisis: could not find myself. Re-run with absolute path." >&2 exit 1 fi # # Now that we know our invocation location, we can determine the directory it # is in. This next line is the moral equivalent of `dirname $myloc` except # that it does not require an extra exec and relies solely on shell variable # expansion. # mydir="${myloc%/*}" # # Not all shells track $PWD accurately so unfortunately, we cannot determine # the absolute path without doing an exec. # NR_INSTALL_LOCATION=`(cd "${mydir}" 2> /dev/null; pwd 2>/dev/null)` fi ilibdir="${NR_INSTALL_LOCATION}" # # Determine the architecture we are executing on. # arch=`(uname -m) 2> /dev/null` || arch="unknown" os=`(uname -s) 2> /dev/null` || os="unknown" case "${arch}" in aarch64 | arm64) arch=aarch64 ;; i[3456789]86) arch=x86 ;; *64* | *amd*) arch=x64 ;; i86pc) if [ "${ostype}" = "solaris" ]; then solarch=`/usr/bin/isainfo -k 2> /dev/null` case "$solarch" in *64*) arch=x64 ;; *) arch=x86 ;; esac else arch=x86 fi ;; unknown) arch=x86 ;; esac # allow override of detected arch [ "${NR_INSTALL_ARCH}" = "x64" -o "${NR_INSTALL_ARCH}" = "x86_64" ] && arch="${NR_INSTALL_ARCH}" # exit if arch is unsupported if [ "${arch}" != "x64" ] && [ "${arch}" != "aarch64" ] ; then msg=$( cat << EOF An unsupported architecture detected. Please visit: https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/ to view compatibilty requirements for the the New Relic PHP agent. EOF ) error "${msg}" echo "The install will now exit." exit 1 fi # # Do some sanity checking. ilibdir should contain the daemon, the agents and # the init scripts. Ensure that is the case. # dmissing= fmissing= check_dir() { if [ ! -d "$1" ]; then if [ -n "$1" ]; then dmissing="${1}${nl}${dmissing}" fi fi } check_file() { if [ ! -f "$1" ]; then if [ -n "$1" ]; then fmissing="${1}${nl}${fmissing}" fi fi } xtradir= if [ -n "${ispkg}" ]; then daemon=/usr/bin/newrelic-daemon else xtradir="${ilibdir}/daemon" daemon="${ilibdir}/daemon/newrelic-daemon.${arch}" fi for d in "${ilibdir}/scripts" "${ilibdir}/agent" "${xtradir}"; do check_dir "${d}" done check_dir "${ilibdir}/agent/${arch}" if [ -n "${dmissing}" ]; then echo "ERROR: the following directories could not be found:" >&2 echo "${dmissing}" | sed -e 's/^/ /' >&2 fi NRIUTIL="${ilibdir}/scripts/newrelic-iutil.${arch}" [ -x "${NRIUTIL}" ] || fmissing="${NRIUTIL}${nl}${fmissing}" if [ -z "${ispkg}" ]; then check_file "${daemon}" check_file "${ilibdir}/scripts/init.alpine" check_file "${ilibdir}/scripts/init.darwin" check_file "${ilibdir}/scripts/init.debian" check_file "${ilibdir}/scripts/init.freebsd" check_file "${ilibdir}/scripts/init.generic" check_file "${ilibdir}/scripts/init.rhel" check_file "${ilibdir}/scripts/init.solaris" check_file "${ilibdir}/scripts/newrelic.sysconfig" check_file "${ilibdir}/scripts/newrelic.cfg.template" check_file "${ilibdir}/scripts/newrelic.xml" check_file "${ilibdir}/scripts/newrelic-php5.logrotate" check_file "${ilibdir}/scripts/newrelic-daemon.logrotate" fi check_file "${ilibdir}/scripts/newrelic.ini.template" # Check that exxtension artifacts exist for all supported PHP versions # MAKE SURE TO UPDATE THIS LIST WHENEVER SUPPORT IS ADDED OR REMOVED # FOR A PHP VERSION # Currently supported versions: # (7.2, 7.3, 7.4) # for x64 if [ ${arch} = x64 ]; then for pmv in "20170718" "20180731" "20190902"; do check_file "${ilibdir}/agent/${arch}/newrelic-${pmv}.so" done fi # Currently supported versions: # (8.0, 8.1, 8.2, 8.3, 8.4, 8.5) # for x64 and aarch64 if [ ${arch} = x64 ] || [ ${arch} = aarch64 ]; then for pmv in "20200930" "20210902" "20220829" "20230831" "20240924" "20250925"; do check_file "${ilibdir}/agent/${arch}/newrelic-${pmv}.so" done fi if [ -n "${fmissing}" ]; then echo "ERROR: the following files could not be found:" >&2 echo "${fmissing}" | sed -e 's/^/ /' >&1 fi if [ -n "${dmissing}" -o -n "${fmissing}" ]; then cat < /dev/null 2>&1) rm -f ${nrilog} ${nrsysinfo} > /dev/null 2>&1 } trap cleanup EXIT echo "NRVERSION: ${nrversion}" >> $nrsysinfo echo "NRVERSION: ${nrversion}" >> $nrilog # # Gather system information and store it in the sysinfo file. # echo "NR_INSTALL_LOCATION: ${NR_INSTALL_LOCATION}" >> $nrsysinfo if [ "${arch}" = "x86" ]; then msg=$( cat << EOF An unsupported architecture detected. Please visit: https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/ to view compatibilty requirements for the the New Relic PHP agent. The install will now exit. EOF ) error "${msg}" exit 1 fi echo "ARCH: ${arch}" >> $nrsysinfo nruname=`uname -a 2>/dev/null` echo "UNAME: $nruname" >> $nrsysinfo env | sort | sed -e 's/^/ENV: /' >> $nrsysinfo if [ -z "${ispkg}" ]; then # # If yum is installed, list the installed packages. # if [ -x /usr/bin/yum ]; then /usr/bin/yum list -q 2> /dev/null | sed -n -e '/installed$/ {s/^/YUM: /;s/[ ]*installed$//;p}' >> $nrsysinfo fi # # If dpkg is installed, list the installed packages. # if [ -x /usr/bin/dpkg-query ]; then /usr/bin/dpkg-query -W -f 'DPKG: ${Package} ${Version} ${Architecture}\n' >> $nrsysinfo 2>/dev/null fi fi fatal() { echo "FATAL: $@" >> $nrilog echo "FATAL: $@" >&2 cat >&2 <> $nrilog } logcmd() { echo "Executing: $@" >> $nrilog "$@" >> $nrilog 2>&1 ret=$? echo "Command returned: $ret" >> $nrilog return $ret } # # Add the specified element to the PATH. When invoked from an installation # package the PATH is frequently restricted. We therefore want to add a few # common elements to the PATH for when we search for PHP installations. # add_to_path() { case "${PATH}" in $1:*) ;; *:$1) ;; *:$1:*) ;; *) [ -d "$1" ] && PATH="${PATH}${PATH_SEPARATOR}$1" ;; esac } add_to_path /usr/local/bin add_to_path /usr/local/php add_to_path /usr/local/php/bin add_to_path /usr/local/zend/bin add_to_path /usr/local/php-7.2/bin add_to_path /usr/local/php-7.3/bin add_to_path /usr/local/php-7.4/bin add_to_path /usr/local/php-8.0/bin add_to_path /usr/local/php-8.1/bin add_to_path /usr/local/php-8.2/bin add_to_path /usr/local/php-8.3/bin add_to_path /usr/local/php-8.4/bin add_to_path /usr/local/php-8.5/bin add_to_path /opt/local/bin add_to_path /usr/php/bin add_to_path /usr/php-7.2/bin add_to_path /usr/php-7.3/bin add_to_path /usr/php-7.4/bin add_to_path /usr/php-8.0/bin add_to_path /usr/php-8.1/bin add_to_path /usr/php-8.2/bin add_to_path /usr/php-8.3/bin add_to_path /usr/php-8.4/bin add_to_path /usr/php-8.5/bin add_to_path /usr/php/7.2/bin add_to_path /usr/php/7.3/bin add_to_path /usr/php/7.4/bin add_to_path /usr/php/8.0/bin add_to_path /usr/php/8.1/bin add_to_path /usr/php/8.2/bin add_to_path /usr/php/8.3/bin add_to_path /usr/php/8.4/bin add_to_path /usr/php/8.5/bin add_to_path /opt/php/bin add_to_path /opt/zend/bin add_to_path /opt/php-7.2/bin add_to_path /opt/php-7.3/bin add_to_path /opt/php-7.4/bin add_to_path /opt/php-8.0/bin add_to_path /opt/php-8.1/bin add_to_path /opt/php-8.2/bin add_to_path /opt/php-8.3/bin add_to_path /opt/php-8.4/bin add_to_path /opt/php-8.5/bin if [ -n "${NR_INSTALL_PATH}" ]; then oIFS="${IFS}" IFS=$PATH_SEPARATOR set -- $NR_INSTALL_PATH while [ -n "$1" ]; do add_to_path $1 shift done IFS="${oIFS}" fi log "Final PATH=$PATH" # # Now search along $PATH looking for PHP installations. We look for either # php or php-config. # nrphplist= oIFS="${IFS}" IFS=${PATH_SEPARATOR} set -- $PATH while [ -n "$1" ]; do pe=$1; shift if [ -x "${pe}/php-config" -a ! -d "${pe}/php-config" ]; then log "Found PHP in ${pe}" nrphplist="${nrphplist}${PATH_SEPARATOR}${pe}" nrphplist=${nrphplist#${PATH_SEPARATOR}} elif [ -x "${pe}/php" -a ! -d "${pe}/php" ]; then log "Found PHP in ${pe}" nrphplist="${nrphplist}${PATH_SEPARATOR}${pe}" nrphplist=${nrphplist#${PATH_SEPARATOR}} else log "No PHP found in ${pe}" fi done IFS="${oIFS}" # # Allow the user to override the computed list of PHP installations with their # own list. This may be useful for people deploying the agent via Puppet etc. # if [ -n "$NR_INSTALL_PHPLIST" ]; then nrphplist=$NR_INSTALL_PHPLIST fi if [ -z "${NR_INSTALL_SILENT}" ]; then bold=`tput bold 2> /dev/null` rmso=`tput sgr0 2> /dev/null` fi # # If we are interactive, display the banner. # banner() { if [ -z "${NR_INSTALL_SILENT}" ]; then clear echo "${bold}New Relic PHP Agent Installation (interactive mode)${rmso}" echo "===================================================" echo "" fi } getyn() { prompt="$1" valid=0 while [ $valid -eq 0 ]; do echo ${en} "${prompt} ([y]es, [n]o or x to e[x]it): ${ec}" read choice case "${choice}" in y* | Y* ) return 0 ;; n* | N* ) return 1 ;; x* | X* | [eE][xX][iI][tT]) exit 0 ;; *) ;; esac done } log "Final PHP list is: $nrphplist" # # It is useful to know exactly how many elements are in the list so we compute # that now. # if [ -z "${nrphplist}" ]; then numphp=0 else oIFS="$IFS" IFS=${PATH_SEPARATOR} set -- $nrphplist numphp=$# IFS="${oIFS}" fi choose_list() { prompt="$1"; shift upper=$1; shift valid=0 chosen= while [ $valid -eq 0 ]; do echo ${en} "${prompt} (1-${upper}, 0 to exit): ${ec}" read choice case "${choice}" in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) choice= ;; esac if [ -n "${choice}" ]; then if [ $choice -ge 0 -a $choice -le $upper ]; then valid=1 fi fi done chosen="${choice}" return $choice } # # If we're interactive, display the main menu. # if [ -z "${imode}" ]; then banner cat < /dev/null` if [ -z "${pi_bin}" -o ! -x "${pi_bin}" ]; then if [ -x "${pdir}/php" ]; then pi_bin="${pdir}/php" fi fi fi if [ -z "${pi_bin}" -a -x "${pdir}/php" ]; then pi_bin="${pdir}/php" fi log "${pdir}: pi_bin=${pi_bin}" phpi= if [ -n "${pi_bin}" ]; then havebin=1 phpi=/tmp/nrinstall-$$.phpi rm -f ${phpi} > /dev/null 2>&1 "${pi_bin}" -i > ${phpi} 2>&1 log "${pdir}: php -i output follows {" cat ${phpi} >> ${nrilog} 2> /dev/null log "${pdir}: php -i output done }" fi log "${pdir}: havebin=${havebin} havecfg=${havecfg}" # # Get the version. # pi_ver= if [ -n "${havebin}" ]; then pi_ver=`echo '' | ${pi_bin} -n -d display_errors=Off -d display_startup_errors=Off -d error_reporting=0 -q 2> /dev/null` else pi_ver=`${pdir}/php-config --version 2> /dev/null` fi log "${pdir}: pi_ver=${pi_ver}" if [ -z "${pi_ver}" ]; then log "${pdir}: couldn't determine version" error "could not determine the version of PHP located at: ${pdir} Please consult the installation documentation to manually install New Relic for this copy of PHP. We apologize for the inconvenience. " return 1 fi case "${pi_ver}" in 7.2.*) ;; 7.3.*) ;; 7.4.*) ;; 8.0.*) pi_php8="yes" ;; 8.1.*) pi_php8="yes" ;; 8.2.*) pi_php8="yes" ;; 8.3.*) pi_php8="yes" ;; 8.4.*) pi_php8="yes" ;; 8.5.*) pi_php8="yes" ;; *) error "unsupported version '${pi_ver}' of PHP found at: ${pdir} Ignoring this particular instance of PHP. Please visit: https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/ to view compatibilty requirements for the the New Relic PHP agent. " log "${pdir}: unsupported version '${pi_ver}'" unsupported_php=1 return 1 ;; esac # # Get the extension and ini directories. # pi_extdir= pi_inidir_cli= pi_inifile_cli= pi_mods_avail= pi_sapi_confdirs= pi_arch="${NR_INSTALL_ARCH}" if [ -n "${havebin}" ]; then # # Prevent daemon spawn either by disabling ini parsing or by # instructing the agent. If an install is in progress, we may not have # the correct configuration yet. If an uninstall is in progress, we # clearly do not want to start the very thing we're trying to remove. # pi_extdir=`echo '' | ${pi_bin} -d display_errors=Off -d display_startup_errors=Off -d error_reporting=0 -d newrelic.daemon.dont_launch=3 -q 2> /dev/null` pi_inidir_cli=`echo '' | ${pi_bin} -n -d display_errors=Off -d display_startup_errors=Off -d error_reporting=0 -q 2> /dev/null` pi_inifile_cli=`echo '' | ${pi_bin} -n -d display_errors=Off -d display_startup_errors=Off -d error_reporting=0 -q 2> /dev/null` if [ -z "${pi_arch}" -a "${arch}" = "x64" ]; then if file "${pi_bin}" 2> /dev/null | grep 'ELF 32-bit' > /dev/null 2>&1; then pi_arch="x86" fi fi else pi_extdir=`${pdir}/php-config --extension-dir 2> /dev/null` fi if [ -n "${pi_inidir_cli}" -a ! -e "${pi_inidir_cli}" ]; then logcmd mkdir -p -m 0755 ${pi_inidir_cli} fi if [ -n "${pi_inidir_cli}" -a ! -d "${pi_inidir_cli}" ]; then pi_inidir_cli= fi if [ -n "${pi_inifile_cli}" -a -d "${pi_inifile_cli}" ]; then pi_inifile_cli="${pi_inifile_cli%/}/php.ini" fi if [ -z "${pi_arch}" ]; then pi_arch="${arch}" fi log "${pdir}: pi_arch=${pi_arch}" # Check if this is a supported arch # Should be caught on startup but add check here to be sure if [ "${pi_arch}" != "x64" ] && [ "${pi_arch}" != "aarch64" ]; then msg=$( cat << EOF An unsupported architecture detected. Please visit: https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/ to view compatibilty requirements for the the New Relic PHP agent. The install will now exit. EOF ) error "${msg}" exit 1 fi # This handles both 32-bit on 64-bit systems and 32-bit only systems if [ "${pi_arch}" = "x86" ]; then error "unsupported 32-bit version '${pi_ver}' of PHP found at: ${pdir} Ignoring this particular instance of PHP. " log "${pdir}: unsupported 32-bit version '${pi_ver}'" unsupported_php=1 return 1 fi if [ "${pi_arch}" = "aarch64" ] && [ "${pi_php8}" != "yes" ]; then error "unsupported aarch64 version '${pi_ver}' of PHP found at: ${pdir} Ignoring this particular instance of PHP. " log "${pdir}: unsupported aarch64 version '${pi_ver}'" unsupported_php=1 return 1 fi log "${pdir}: pi_inidir_cli=${pi_inidir_cli}" log "${pdir}: pi_inifile_cli=${pi_inifile_cli}" # # Get and check the include directory. # pi_incdir= if [ -n "${havecfg}" ]; then pi_incdir=`${pdir}/php-config --include-dir 2> /dev/null` [ -n "${pi_incdir}" -a -d "${pi_incdir}" -a -d "${pi_incdir}/main" -a -d "${pi_incdir}/Zend" ] || pi_incdir= fi log "${pdir}: pi_incdir=${pi_incdir}" # # Get the (possibly second) ini scan directory. # pi_inidir_dso= pi_inifile_dso= pi_extdir2= if [ -n "${pi_incdir}" -a -f "${pi_incdir}/main/build-defs.h" ]; then pi_inidir_dso=`sed -n '/^#define[ ]PHP_CONFIG_FILE_SCAN_DIR / s,.*#define.*[ ]"\(.*\)",\1,p' "${pi_incdir}/main/build-defs.h" 2> /dev/null` pi_inifile_dso=`sed -n '/^#define[ ]PHP_CONFIG_FILE_PATH / s,.*#define.*[ ]"\(.*\)",\1,p' "${pi_incdir}/main/build-defs.h" 2> /dev/null` pi_extdir2=`sed -n '/^#define[ ]PHP_EXTENSION_DIR / s,.*#define.*[ ]"\(.*\)",\1,p' "${pi_incdir}/main/build-defs.h" 2> /dev/null` fi if [ -n "${pi_inidir_dso}" -a ! -d "${pi_inidir_dso}" ]; then pi_inidir_dso= fi if [ -n "${pi_inifile_dso}" -a -d "${pi_inifile_dso}" ]; then pi_inifile_dso="${pi_inifile_dso%/}/php.ini" else pi_inifile_dso= fi log "${pdir}: pi_inidir_dso=${pi_inidir_dso}" log "${pdir}: pi_inifile_dso=${pi_inifile_dso}" # # Trim trailing / # pi_extdir="${pi_extdir%/}" pi_extdir2="${pi_extdir2%/}" if [ -z "${pi_extdir}" -a -n "${pi_extdir2}" ]; then pi_extdir="${pi_extdir2}" pi_extdir2= fi if [ -z "${pi_extdir}" ]; then error "could not determine extension directory for the PHP located at: ${pdir} Please consult the installation documentation to manually install New Relic for this copy of PHP. We apologize for the inconvenience. " return 1 fi if [ ! -d "${pi_extdir}" ]; then error "computed PHP extension directory: ${pi_extdir} which is for the PHP installation located at: ${pdir} does not exist. This particular instance of PHP will be skipped. " return 1 fi if [ -n "${pi_extdir2}" -a "${pi_extdir}" = "${pi_extdir2}" ]; then pi_extdir2= fi if [ -n "${pi_extdir2}" -a ! -d "${pi_extdir2}" ]; then pi_extdir2= fi log "${pdir}: pi_extdir=${pi_extdir}" log "${pdir}: pi_extdir2=${pi_extdir2}" # # Get the module API version # pi_modver= case "${pi_ver}" in 7.2.*) pi_modver="20170718" ;; 7.3.*) pi_modver="20180731" ;; 7.4.*) pi_modver="20190902" ;; 8.0.*) pi_modver="20200930" ;; 8.1.*) pi_modver="20210902" ;; 8.2.*) pi_modver="20220829" ;; 8.3.*) pi_modver="20230831" ;; 8.4.*) pi_modver="20240924" ;; 8.5.*) pi_modver="20250925" ;; esac log "${pdir}: pi_modver=${pi_modver}" # # Get whether or not ZTS (Zend Thread Safety) is enabled # pi_zts= if [ -n "${havebin}" ]; then if grep 'Thread Safety' ${phpi} | grep 'enabled' > /dev/null 2>&1; then pi_zts=yes elif grep 'Thread Safety' ${phpi} | grep 'disabled' > /dev/null 2>&1; then pi_zts=no fi fi if [ -z "${pi_zts}" ]; then if [ -n "${pincdir}" -a -f "${pincdir}/main/php_config.h" ]; then if grep '^#define[ ]*ZTS[ ]*1' "${pincdir}/main/php_config.h" > /dev/null 2>&1; then pi_zts="yes" else pi_zts="no" fi else # # If we can't find the header to check for ZTS, see if we can use the extension # directory name to check. It will frequently have something like +zts in its # name if ZTS is enabled. # pi_zts="no" case "${pi_extdir}" in *non-zts* | *no-zts*) ;; *zts*) pi_zts="yes" ;; *) if [ -n "${pi_extdir2}" ]; then case "${pi_extdir2}" in *non-zts* | *no-zts*) ;; *zts*) pi_zts="yes" ;; esac fi ;; esac fi fi log "${pdir}: pi_zts=${pi_zts}" # zts installs are no longer supported if [ "${pi_zts}" = "yes" ]; then msg=$( cat << EOF An unsupported PHP ZTS build has been detected. Please refer to this link: https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/ to view compatibilty requirements for the the New Relic PHP agent. The install will now exit. EOF ) error "${msg}" exit 1 fi # # This is where we figure out where to put the ini file, if at all. We only do # this if there is a scan directory defined. If the particular PHP installation # does not use a scan directory and instead only uses a single ini file, we add # that ini file to a list, and display instructions at the end of the install # on what and how to modify that file. # if [ "${pi_inifile_cli}" = "${pi_inifile_dso}" ]; then pi_inifile_dso= fi if [ "${pi_inidir_cli}" = "${pi_inidir_dso}" ]; then pi_inidir_dso= fi if [ -n "${pi_inidir_cli}" -o -n "${pi_inidir_dso}" ]; then # # We have either a CLI scan directory, or a DSO scan directory, or both. If we # have both, we check to see if they are the same, and if not, we check to see # if both of them have a "conf.d" symbolic link that points to the same place. # If they do, we set both directories to point to that same directory, and the # install and uninstall both know to check that the directories are not equal # so they won't do the work twice. If we only have one or the other, or we have # both but they both point to different places, we have nothing to do. # if [ -n "${pi_inidir_cli}" -a -n "${pi_inidir_dso}" ]; then sdirset= aconfcli=`${NRIUTIL} realpath "${pi_inidir_cli%/}/conf.d"` aconfdso=`${NRIUTIL} realpath "${pi_inidir_dso%/}/conf.d"` if [ -n "${aconfcli}" -a -n "${aconfdso}" -a "${aconfcli}" -ef "${aconfdso}" ]; then sdirset="${aconfcli}" else aconfcli=`${NRIUTIL} realpath "${pi_inidir_cli%/}"` aconfdso=`${NRIUTIL} realpath "${pi_inidir_dso%/}"` if [ -n "${aconfcli}" -a -n "${aconfdso}" -a "${aconfcli}" -ef "${aconfdso}" ]; then sdirset="${aconfcli}" fi fi if [ -n "${sdirset}" ]; then # # Unset all ini files and the DSO ini directory, leaving just the CLI # directory. This will result in this being the only place that the ini file # gets installed. # pi_inifile_cli= pi_inifile_dso= pi_inidir_dso= pi_inidir_cli="${sdirset}" fi fi fi # Bias directories over files. if [ -n "${pi_inifile_cli}" -a -n "${pi_inidir_cli}" ]; then pi_inifile_cli= fi if [ -n "${pi_inifile_dso}" -a -n "${pi_inidir_dso}" ]; then pi_inifile_dso= fi # # Ubuntu 13.10 has separate Apache, CLI and FPM configuration directories, # but our detection algorithms currently only detect the CLI directory. As a # stopgap, let's detect that situation and set ${pi_inidir_dso} so that the # INI file gets installed to the right place. # for cfg_pfx in /etc/php5 /etc/php7 /etc/php8 /etc/php/[578].*; do if [ "${pi_inidir_cli}" = "${cfg_pfx}/cli/conf.d" -a -z "${pi_inidir_dso}" ]; then # # Check Apache first, then FPM. If both are installed, we want FPM to win: # while there are many ways to end up with libapache2-mod-php5 installed, # it's unlikely php5-fpm will be installed unless FPM is actually in use. # if [ -d "${cfg_pfx}/apache2/conf.d" ]; then pi_inidir_dso="${cfg_pfx}/apache2/conf.d" fi if [ -d "${cfg_pfx}/fpm/conf.d" ]; then pi_inidir_dso="${cfg_pfx}/fpm/conf.d" fi # # Debian/Ubuntu systems can use a mods-available directory to manage # PHP module INI files. When the mods-available directory exists, we # install the newrelic.ini file there and create symlinks in each # SAPI's conf.d directory. This is consistent with how the Debian # phpenmod/phpdismod tools work. # if [ -d "${cfg_pfx}/mods-available" ]; then # # If a previous install placed a plain newrelic.ini directly in a # SAPI conf.d directory, skip the mods-available redirect to avoid # creating a duplicate INI with default settings. The user's # existing customized files in conf.d will continue to be used. # pi_has_confd_ini= for sapi_dir in "${cfg_pfx}"/*/conf.d; do if [ -f "${sapi_dir}/newrelic.ini" -a ! -L "${sapi_dir}/newrelic.ini" ]; then pi_has_confd_ini=1 break fi done if [ -z "${pi_has_confd_ini}" ]; then pi_mods_avail="${cfg_pfx}/mods-available" pi_sapi_confdirs="" for sapi_dir in "${cfg_pfx}"/*/conf.d; do if [ -d "${sapi_dir}" ]; then pi_sapi_confdirs="${pi_sapi_confdirs} ${sapi_dir}" fi done pi_inidir_cli="${cfg_pfx}/mods-available" pi_inidir_dso="" fi fi fi done # # Set the list of ini files to display to the user # if [ -n "${pi_inifile_cli}" ]; then pi_inilist="${pi_inilist}${PATH_SEPARATOR}${pi_inifile_cli}" pi_inilist=${pi_inilist#${PATH_SEPARATOR}} fi if [ -n "${pi_inifile_dso}" ]; then pi_inilist="${pi_inilist}${PATH_SEPARATOR}${pi_inifile_dso}" pi_inilist=${pi_inilist#${PATH_SEPARATOR}} fi log "${pdir}: final pi_inifile_cli=${pi_inifile_cli}" log "${pdir}: final pi_inifile_dso=${pi_inifile_dso}" log "${pdir}: final pi_inidir_cli=${pi_inidir_cli}" log "${pdir}: final pi_inidir_dso=${pi_inidir_dso}" if [ -n "${phpi}" ]; then rm -f $phpi > /dev/null 2>&1 fi return 0 } # # Low-level work-horse of doing the actual installation. For new installations # we copy in the template if we are using config directories. For existing # installations we do any upgrade work we need to on existing files (but NOT # on php.ini files, just on newrelic.ini files in config directories. # install_agent_here() { # # First things first--we ensure that a link to the correct module exists. # zts= istat= if [ "${pi_zts}" = "yes" ]; then zts="-zts" # Force copy of zts files as it is EOL so this will # prevent future eraseure of linked to file from # leading to a dangling symlink NR_INSTALL_USE_CP_NOT_LN=1 fi srcf="${ilibdir}/agent/${pi_arch}/newrelic-${pi_modver}${zts}.so" destf="${pi_extdir}/newrelic.so" logcmd rm -f "${destf}" if [ -z "${NR_INSTALL_USE_CP_NOT_LN}" ]; then logcmd ln -sf "${srcf}" "${destf}" || { istat="failed" log "${pdir}: link '${srcf}' -> '${destf}' FAILED!" } else logcmd cp -f "${srcf}" "${destf}" || { istat="failed" log "${pdir}: copy '${srcf}' -> '${destf}' FAILED!" } fi if [ -z "${istat}" -a -n "${pi_extdir2}" ]; then destf="${pi_extdir2}/newrelic.so" logcmd rm -f "${destf}" if [ -z "${NR_INSTALL_USE_CP_NOT_LN}" ]; then logcmd ln -sf "${srcf}" "${destf}" || { istat="failed" log "${pdir}: link '${srcf}' -> '${destf}' FAILED!" } else logcmd cp -f "${srcf}" "${destf}" || { istat="failed" log "${pdir}: copy '${srcf}' -> '${destf}' FAILED!" } fi fi if [ -z "${istat}" ]; then # # Now check to see if we should copy in a sample newrelic.ini file. This will # only ever be done if we have INI directories, and only if no newrelic.ini # file exists in the target directory. # if [ -n "${pi_inidir_cli}" -a ! -f "${pi_inidir_cli}/newrelic.ini" ]; then if sed -e "s/REPLACE_WITH_REAL_KEY/${nrkey}/" "${ilibdir}/scripts/newrelic.ini.template" > "${pi_inidir_cli}/newrelic.ini"; then logcmd chmod 644 "${pi_inidir_cli}/newrelic.ini" if [ -z "${NR_INSTALL_SILENT}" ]; then echo " Install Status : ${pi_inidir_cli}/newrelic.ini created" fi else istat="failed" log "${pdir}: copy ini template to ${pi_inidir_cli}/newrelic.ini failed" fi fi if [ -z "${istat}" -a -n "${pi_inidir_dso}" -a ! -f "${pi_inidir_dso}/newrelic.ini" ]; then if sed -e "s/REPLACE_WITH_REAL_KEY/${nrkey}/" "${ilibdir}/scripts/newrelic.ini.template" > "${pi_inidir_dso}/newrelic.ini"; then logcmd chmod 644 "${pi_inidir_dso}/newrelic.ini" if [ -z "${NR_INSTALL_SILENT}" ]; then echo " Install Status : ${pi_inidir_dso}/newrelic.ini created" fi else istat="failed" log "${pdir}: copy ini template to ${pi_inidir_dso}/newrelic.ini failed" fi fi fi # # If we installed to mods-available, create symlinks in each SAPI conf.d # directory so PHP picks up the module configuration. This follows the # Debian convention used by phpenmod/phpdismod with a "20-" priority prefix. # if [ -n "${pi_mods_avail}" -a -f "${pi_mods_avail}/newrelic.ini" ]; then for sapi_confdir in ${pi_sapi_confdirs}; do if [ -d "${sapi_confdir}" ]; then if [ ! -e "${sapi_confdir}/newrelic.ini" -a ! -e "${sapi_confdir}/20-newrelic.ini" ]; then if logcmd ln -sf "${pi_mods_avail}/newrelic.ini" "${sapi_confdir}/20-newrelic.ini"; then if [ -z "${NR_INSTALL_SILENT}" ]; then echo " Install Status : ${sapi_confdir}/20-newrelic.ini symlinked" fi log "${pdir}: created symlink ${sapi_confdir}/20-newrelic.ini -> ${pi_mods_avail}/newrelic.ini" else istat="failed" log "${pdir}: failed to create symlink ${sapi_confdir}/20-newrelic.ini" fi fi fi done fi if [ -n "${pi_inidir_cli}" -a -f "${pi_inidir_cli}/newrelic.ini" ]; then pi_nrinilist="${pi_nrinilist}${PATH_SEPARATOR}${pi_inidir_cli%/}/newrelic.ini" pi_nrinilist=${pi_nrinilist#${PATH_SEPARATOR}} fi if [ -n "${pi_inidir_dso}" -a -f "${pi_inidir_dso}/newrelic.ini" ]; then pi_nrinilist="${pi_nrinilist}${PATH_SEPARATOR}${pi_inidir_dso%/}/newrelic.ini" pi_nrinilist=${pi_nrinilist#${PATH_SEPARATOR}} fi if [ -z "${istat}" ]; then istat="OK" fi if [ -z "${NR_INSTALL_SILENT}" ]; then echo " Install Status : ${istat}" fi log "${pdir}: install status: ${istat}" } # # Install the agent. This is a front-end to the real work which is in # install_agent_here - it installs the agent into a specific PHP. This front # end function presents the user with a list of PHP locations and asks which # of the various installations the user wants to install to. If there is only # 1 version of PHP detected, we simply call install_agent_here with that # version. # do_install() { if [ -n "${NR_INSTALL_KEY}" ]; then case "${NR_INSTALL_KEY}" in ????????????????????????????????????????) ;; *) error "NR_INSTALL_KEY environment variable invalid" exit 1 ;; esac fi banner if [ ! -d /var/log/newrelic ]; then if [ -d /var/log ]; then logcmd mkdir /var/log/newrelic logcmd chmod 0755 /var/log/newrelic log "created /var/log/newrelic" fi fi if [ ! -d /etc/newrelic ]; then if ! logcmd mkdir /etc/newrelic; then fatal "failed to create directory /etc/newrelic" fi else if [ -z "${ispkg}" -a -f /etc/newrelic/newrelic.cfg ]; then if grep '^[ ]*license' /etc/newrelic/newrelic.cfg > /dev/null 2>&1; then if ! grep 'OBSOLESCENCE NOTICE' /etc/newrelic/newrelic.cfg > /dev/null 2>&1; then sed -e '/^[ ]*license/ a\ # OBSOLESCENCE NOTICE\ # The license keyword is now ignored in this file. Instead it is now\ # set by the agent (for example in your INI file for the PHP agent). As a\ # temporary measure to ensure the agent functions correctly the license above\ # has been saved in the file /etc/newrelic/upgrade_please.key. If no license\ # is specified in the agent it will use the license from that file. This is a\ # TEMPORARY measure and you are strongly encouraged to upgrade your agent\ # configuration file and remove /etc/newrelic/upgrade_please.key in order to\ # eliminate any confusion about where the license used comes from. Please also\ # remove the license keyword above and this notice.\ \ ' /etc/newrelic/newrelic.cfg > /etc/newrelic/newrelic.cfg.tmp 2>/dev/null cp -f /etc/newrelic/newrelic.cfg.tmp /etc/newrelic/newrelic.cfg > /dev/null 2>&1 rm -f /etc/newrelic/newrelic.cfg.tmp > /dev/null 2>&1 nrkey=`sed -n -e 's/^[ ]*license_key[ ]*=[ ]*//p' -e 's/[ ]*$//' /etc/newrelic/newrelic.cfg 2> /dev/null` if [ -n "${nrkey}" ]; then echo "${nrkey}" > /etc/newrelic/upgrade_please.key 2> /dev/null chmod 644 /etc/newrelic/upgrade_please.key 2> /dev/null fi fi fi fi fi logcmd chown root /etc/newrelic logcmd chmod 755 /etc/newrelic if [ -f /etc/newrelic/upgrade_please.key ]; then nrkey=`head -1 /etc/newrelic/upgrade_please.key 2>/dev/null` fi if [ -n "${NR_INSTALL_KEY}" ]; then nrkey="${NR_INSTALL_KEY}" fi if [ -z "${NR_INSTALL_SILENT}" -a -z "${nrkey}" ]; then badlicense=1 while [ "${badlicense}" = "1" ]; do echo ${en} " Enter New Relic license key (or leave blank): ${ec}" read nrkey if [ -z "${nrkey}" ]; then badlicense=0 else case "${nrkey}" in ????????????????????????????????????????) badlicense=0 ;; *) echo "Invalid license - must be exactly 40 characters" ;; esac fi done fi if [ -z "${nrkey}" ]; then nrkey="REPLACE_WITH_REAL_KEY" fi if [ $numphp -gt 1 ]; then if [ -z "${NR_INSTALL_SILENT}" ]; then cat < /dev/null 2>&1; then if grep -q '^[ ]*newrelic.logfile' "${ifile}" > /dev/null 2>&1; then tmpifile="${ifile}.nr$$" sed -e "/^[ ]*newrelic.logfile/ a\\ newrelic.license = \"${nrkey}\" " "${ifile}" > "${tmpifile}" 2> /dev/null && cp -f "${tmpifile}" "${ifile}" > /dev/null 2>&1 && rm -f "${tmpifile}" > /dev/null 2>&1 elif grep -q '^[ ]\[newrelic\]' "${ifile}" > /dev/null 2>&1; then tmpifile="${ifile}.nr$$" sed -e "/^[ ]\[newrelic\]/ a\\ newrelic.license = \"${nrkey}\" " "${ifile}" > "${tmpifile}" 2> /dev/null && cp -f "${tmpifile}" "${ifile}" > /dev/null 2>&1 && rm -f "${tmpifile}" > /dev/null 2>&1 else tffn="${ifile##*/}" if [ "${tffn}" = "newrelic.ini" ]; then echo "newrelic.license = \"${nrkey}\"" >> "${ifile}" else sed -e "s/REPLACE_WITH_REAL_KEY/${nrkey}/" "${ilibdir}/scripts/newrelic.ini.template" >> "${ifile}" fi fi else tmpifile="${ifile}.nr$$" sed -e "s/REPLACE_WITH_REAL_KEY/${nrkey}/" "${ifile}" > "${tmpifile}" 2> /dev/null && cp -f "${tmpifile}" "${ifile}" > /dev/null 2>&1 && rm -f "${tmpifile}" > /dev/null 2>&1 fi fi done IFS="${ioIFS}" fi if [ -n "${pi_inilist}" ]; then echo "INI files that require manual editing (template located at ${ilibdir}/scripts/newrelic.ini.template):" >> $nrilog if [ -z "${NR_INSTALL_SILENT}" ]; then cat <> $nrilog if [ -z "${NR_INSTALL_SILENT}" ]; then echo " ${ifile}" fi done IFS="${ioIFS}" if [ -z "${NR_INSTALL_SILENT}" ]; then echo "" fi fi # # Now deal with the daemon. # set_daemon_location idaemon="${dodaemon}" if [ -z "${ispkg}" -a -z "${idaemon}" ]; then idaemon=yes fi if [ "x${idaemon}" = "xyes" ]; then if [ "${ostype}" = "solaris" ]; then logcmd mkdir -p -m 0755 /opt/newrelic/bin fi if logcmd rm -f "${daemonloc}"; then if logcmd cp -f "${daemon}" "${daemonloc}"; then logcmd chmod 755 "${daemonloc}" log "daemon installed" else fatal "failed to copy new daemon into place" fi else fatal "could not remove existing daemon" fi fi # # Last, but not least, we need to install the init script if this was not a # package installation (which will already have installed the correct # script). # set_osdifile if [ -z "${ispkg}" ]; then # ensure target directory exists if [ ! -d "$(dirname ${osdifile})" ]; then logcmd mkdir -p -m 0755 "$(dirname ${osdifile})" fi if logcmd cp -f "${ilibdir}/scripts/init.${ostype}" "${osdifile}"; then logcmd chmod 755 "${osdifile}" || { fatal "failed to set permissions on ${osdifile}" } else fatal "failed to copy daemon init script to ${osdifile}" fi sysconf= if [ "${ostype}" = "rhel" ]; then sysconf=/etc/sysconfig/newrelic-daemon elif [ "${ostype}" = "debian" ]; then sysconf=/etc/default/newrelic-daemon elif [ "${ostype}" = "alpine" ]; then sysconf=/etc/conf.d/newrelic-daemon fi if [ -n "${sysconf}" -a ! -f "${sysconf}" ]; then # ensure target directory exists if [ ! -d "$(dirname ${sysconf})" ]; then logcmd mkdir -p -m 0755 "$(dirname ${sysconf})" fi if logcmd cp -f "${ilibdir}/scripts/newrelic.sysconfig" "${sysconf}"; then logcmd chmod 755 "${sysconf}" || { fatal "failed to set permissions on ${sysconf}" } else fatal "failed to copy script to ${sysconf}" fi fi if [ "${ostype}" = "solaris" ]; then logcmd /usr/sbin/svccfg import "${ilibdir}/scripts/newrelic.xml" || { error "failed to install the New Relic daemon service" } fi logcmd cp -f "${ilibdir}/scripts/newrelic.cfg.template" /etc/newrelic/newrelic.cfg.template fi if [ -x "${osdifile}" -a -f /etc/newrelic/newrelic.cfg ]; then NR_SILENT=yes SILENT=yes "${osdifile}" restart > /dev/null 2>&1 fi if [ -z "${NR_INSTALL_SILENT}" ]; then if [ -n "${dodaemon}" ]; then if [ "${imode}" = "install_daemon" ] ; then cat < /dev/null 2>&1 || dorm=0 else dorm=0 fi if [ "x${dorm}" = "x1" -o "x${purge}" = "x1" ]; then logcmd rm -f "${target}" fi } remove_from_here() { destf="${pi_extdir}/newrelic.so" if [ -f "${destf}" ]; then logcmd rm -f "${destf}" fi if [ -n "${pi_extdir2}" ]; then destf="${pi_extdir2}/newrelic.so" if [ -f "${destf}" ]; then logcmd rm -f "${destf}" fi fi if [ -n "${pi_inidir_cli}" -a -f "${pi_inidir_cli}/newrelic.ini" ]; then remove_if_unchanged "${pi_inidir_cli}/newrelic.ini" "${ilibdir}/scripts/newrelic.ini.template" fi if [ -n "${pi_inidir_dso}" -a -f "${pi_inidir_dso}/newrelic.ini" ]; then remove_if_unchanged "${pi_inidir_dso}/newrelic.ini" "${ilibdir}/scripts/newrelic.ini.template" fi # # Remove symlinks created in SAPI conf.d directories when the INI file # was installed into mods-available. # if [ -n "${pi_mods_avail}" ]; then for sapi_confdir in ${pi_sapi_confdirs}; do if [ -L "${sapi_confdir}/20-newrelic.ini" ]; then logcmd rm -f "${sapi_confdir}/20-newrelic.ini" log "removed symlink ${sapi_confdir}/20-newrelic.ini" fi done fi } do_uninstall() { banner phpulist="${nrphplist}" # # Remove new .ini and .so links for the versions we were told to. # pi_inilist= if [ -n "${phpulist}" ]; then ioIFS="$IFS" IFS=${PATH_SEPARATOR} for pdir in $phpulist; do IFS="${ioIFS}" gather_info "${pdir}" || continue # keep deprecated/eol module if requested if [ -n "${NR_UNINSTALL_KEEP_ZTS}" ]; then if [ -z "${NR_INSTALL_SILENT}" ]; then echo "Keeping module in ${pdir} because NR_UNINSTALL_KEEP_ZTS set." fi continue fi if [ -z "${NR_INSTALL_SILENT}" ]; then echo "Removing from this PHP : ${pdir}" echo " Module directory : ${pi_extdir}" if [ -n "${pi_extdir2}" ]; then echo " Module directory : ${pi_extdir2}" fi fi remove_from_here if [ -z "${NR_INSTALL_SILENT}" ]; then echo "" fi done IFS="${ioIFS}" fi # # Remove init script. # set_osdifile if [ -x "${osdifile}" ]; then NR_SILENT=yes SILENT=yes "${osdifile}" stop > /dev/null 2>&1 fi if [ -z "${ispkg}" ]; then remove_if_unchanged "${osdifile}" "${ilibdir}/scripts/init.${ostype}" fi # # Remove daemon config file. # remove_if_unchanged /etc/newrelic/newrelic.cfg "${ilibdir}/scripts/newrelic.cfg.template" # # Remove the daemon. # if [ -z "${ispkg}" ]; then set_daemon_location logcmd rm -f "${daemonloc}" fi if [ -z "${NR_INSTALL_SILENT}" -a "x${purge}" = "x0" ]; then cat <