Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(path) : fix PHP paths in backup script #6787

Merged
merged 4 commits into from
Oct 17, 2018
Merged

Conversation

miteto
Copy link
Contributor

@miteto miteto commented Oct 11, 2018

MON-2917

  • Fix PHP CLI executable path
  • Fix php.ini path

- Fix PHP CLI executable path
- Fix php.ini path
@@ -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();'`;
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in next commit

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') {
Copy link
Contributor

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.

Copy link
Contributor

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 ?

Copy link
Contributor

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?

@kduret kduret changed the title fix(path) : fix PHP paths fix(path) : fix PHP paths in backup script Oct 12, 2018
…p.ini

- Add php.d folder to backup
- Remove default php.ini from backup
@@ -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/`;
Copy link
Contributor

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 ?

Copy link
Contributor

@lpinsivy lpinsivy Oct 16, 2018

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
@ganoze ganoze merged commit 320e8cb into master Oct 17, 2018
@ganoze ganoze deleted the fix-backup-perl-script branch October 17, 2018 14:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants