Skip to content

Commit

Permalink
Merge pull request #1131 from newrelic/php-debian-fix
Browse files Browse the repository at this point in the history
fix(php): fixed php debian recipe to accommodate recent php agent changes
  • Loading branch information
shashank-reddy-nr authored Nov 12, 2024
2 parents 7792bc3 + bbcf872 commit c7dbc92
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions recipes/newrelic/apm/php/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,20 @@ install:
# Get the PHP INI Directory associated with this specific NR INI file
#
php_ini_dir=$(echo $ini | sed -n 's/\(.*\)\/conf.d/\1/p')
if [ -z "${php_ini_dir}" ]; then
php_ini_dir=$ini
if [[ -z "${php_ini_dir}" ]]; then
if [[ -z "${CLI_DIRS}" ]]; then
if [[ -d "${ini}/../apache2" ]]; then
php_ini_dir="${ini}/../apache2"
fi
if [[ -d "${ini}/../fpm" ]]; then
php_ini_dir="${ini}/../fpm"
fi
elif [[ -d "${ini}/../cli" ]]; then
php_ini_dir="${ini}/../cli"
else
php_ini_dir=$ini
fi
fi
#
# Get the PHP Binary directory associated with this particular NR INI file.
sed_slash_ini=$(echo "${ini}" | sed 's/\//\\\//g')
Expand Down Expand Up @@ -501,6 +511,10 @@ install:
fi
sed -i "s/newrelic.appname = \"[^\"]*\"/newrelic.appname = \"${APPLICATION_NAME}\"/" $ini_full_name
LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"
sed -i -E "s/newrelic.license = \"(REPLACE_WITH_REAL_KEY|)\"/newrelic.license = \"${LICENSE_KEY}\"/" $ini_full_name
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
sed -i 's/;newrelic.daemon.collector_host = ""/newrelic.daemon.collector_host = "staging-collector.newrelic.com"/' $ini_full_name
sed -i 's/;newrelic.loglevel = "info"/newrelic.loglevel = "verbosedebug"/' $ini_full_name
Expand All @@ -520,7 +534,7 @@ install:
#
target_ini_dir="/etc/php5/conf.d/"
if [ -x /usr/sbin/phpquery ]; then
target_ini_dir="${ini}/../../mods-available/"
target_ini_dir="${php_ini_dir}/../mods-available/"
elif [ -x /usr/sbin/php5endmod ]; then
target_ini_dir="/etc/php5/mods-available/"
fi
Expand All @@ -533,7 +547,11 @@ install:
# This ensures we always get the most up to date newrelic.ini file on the
# system.
#
mv ${ini_full_name} ${target_ini_dir}
ini_source_dir=$(dirname "$(realpath "$ini_full_name")")
ini_destination_dir=$(realpath "$target_ini_dir")
if [[ "$ini_source_dir" != "$ini_destination_dir" ]]; then
mv "${ini_full_name}" "${ini_destination_dir}"
fi
#
# We rely on the package installer to enable the newrelic module.
Expand Down

0 comments on commit c7dbc92

Please sign in to comment.