-
Notifications
You must be signed in to change notification settings - Fork 240
fix(path) : fix PHP paths in backup script #6787
Conversation
- Fix PHP CLI executable path - Fix php.ini path
cron/centreon-backup.pl
Outdated
@@ -312,12 +312,12 @@ () | |||
my @tab_php_ini; | |||
|
|||
# PHP CLI | |||
my $result = `php -r 'echo php_ini_loaded_file();'`; | |||
my $result = `/opt/rh/rh-php71/root/usr/bin/php -r 'echo php_ini_loaded_file();'`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the @PHP_BIN@ macro that will be replaced automatically during packaging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in next commit
cron/centreon-backup.pl
Outdated
push(@tab_php_ini, trim($result)); | ||
|
||
# Apache | ||
if ( -e '/etc/php.ini') { | ||
push(@tab_php_ini, '/etc/php.ini'); | ||
if ( -e '/etc/opt/rh/rh-php71/php.ini') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of pushing this file ? It seems to be the default file loaded by the PHP binary above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kduret Do you agree that the additional backup of php.ini is useless ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you.
we should backup php.d directory, aren't we?
…p.ini - Add php.d folder to backup - Remove default php.ini from backup
cron/centreon-backup.pl
Outdated
@@ -585,6 +578,11 @@ () | |||
print STDERR "Unable to copy PHP configuration file\n"; | |||
} | |||
} | |||
# PHP configuration ini files | |||
`cp -pr /etc/opt/rh/rh-php71/php.d/ $TEMP_CENTRAL_ETC_DIR/php/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of hardcoded paths. People that are not using rh-php71 will have issues using Centreon Backup. For me this is a no go.
Is there any other way to backup the php.d directory ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If php binary is know by system:
PHP=$(php --info | grep "Additional .ini files parsed" | cut -d '>' -f2 | xargs dirname); echo $PHP
If $PHP is empty, maybe make a list of test to perform (rh-php71, php-7.x-remi, ...) or try if locate exists to run
PHP=$(locate php.ini | egrep "php.ini$" | xargs dirname)
- Remove hardcoded path to php - Get php configuration files via php_ini_scanned_files
MON-2917