@@ -465,10 +465,20 @@ install:
465
465
# Get the PHP INI Directory associated with this specific NR INI file
466
466
#
467
467
php_ini_dir=$(echo $ini | sed -n 's/\(.*\)\/conf.d/\1/p')
468
- if [ -z "${php_ini_dir}" ]; then
469
- php_ini_dir=$ini
468
+ if [[ -z "${php_ini_dir}" ]]; then
469
+ if [[ -z "${CLI_DIRS}" ]]; then
470
+ if [[ -d "${ini}/../apache2" ]]; then
471
+ php_ini_dir="${ini}/../apache2"
472
+ fi
473
+ if [[ -d "${ini}/../fpm" ]]; then
474
+ php_ini_dir="${ini}/../fpm"
475
+ fi
476
+ elif [[ -d "${ini}/../cli" ]]; then
477
+ php_ini_dir="${ini}/../cli"
478
+ else
479
+ php_ini_dir=$ini
480
+ fi
470
481
fi
471
-
472
482
#
473
483
# Get the PHP Binary directory associated with this particular NR INI file.
474
484
sed_slash_ini=$(echo "${ini}" | sed 's/\//\\\//g')
@@ -501,6 +511,10 @@ install:
501
511
fi
502
512
503
513
sed -i "s/newrelic.appname = \"[^\"]*\"/newrelic.appname = \"${APPLICATION_NAME}\"/" $ini_full_name
514
+
515
+ LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"
516
+ sed -i -E "s/newrelic.license = \"(REPLACE_WITH_REAL_KEY|)\"/newrelic.license = \"${NEW_RELIC_LICENSE_KEY}\"/" $ini_full_name
517
+
504
518
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
505
519
sed -i 's/;newrelic.daemon.collector_host = ""/newrelic.daemon.collector_host = "staging-collector.newrelic.com"/' $ini_full_name
506
520
sed -i 's/;newrelic.loglevel = "info"/newrelic.loglevel = "verbosedebug"/' $ini_full_name
@@ -520,7 +534,7 @@ install:
520
534
#
521
535
target_ini_dir="/etc/php5/conf.d/"
522
536
if [ -x /usr/sbin/phpquery ]; then
523
- target_ini_dir="${ini}/.. /../mods-available/"
537
+ target_ini_dir="${php_ini_dir} /../mods-available/"
524
538
elif [ -x /usr/sbin/php5endmod ]; then
525
539
target_ini_dir="/etc/php5/mods-available/"
526
540
fi
@@ -533,7 +547,11 @@ install:
533
547
# This ensures we always get the most up to date newrelic.ini file on the
534
548
# system.
535
549
#
536
- mv ${ini_full_name} ${target_ini_dir}
550
+ ini_source_dir=$(dirname "$(realpath "$ini_full_name")")
551
+ ini_destination_dir=$(realpath "$target_ini_dir")
552
+ if [[ "$ini_source_dir" != "$ini_destination_dir" ]]; then
553
+ mv "${ini_full_name}" "${ini_destination_dir}"
554
+ fi
537
555
538
556
#
539
557
# We rely on the package installer to enable the newrelic module.
0 commit comments