libapache2-mod-php7.0 is depending on php7.0-cli so they should always be installed together and the latter package should be installed first.
They both have a php.ini file, but it would be different.
libapache will always try to provide its bits to is on an install:
phpini="/etc/php/7.0/apache2/php.ini"
ucf /usr/lib/php/7.0/php.ini-production $phpini
it then registers itself with the file
ucfr libapache2-mod-php7.0 $phpini
php7.0-cli essentially does the same calls as above but with package name "php7.0-cli" and the path is different.
phpini="/etc/php/7.0/cli/php.ini"
I ran an install of the packages on Xenial and it seems to work fine that way:
Setting up php7.0-cli (7.0.32-0ubuntu0.16.04.1) ...
update-alternatives: using /usr/bin/php7.0 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.0 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.0 to provide /usr/bin/phar.phar (phar.phar) in auto mode
Creating config file /etc/php/7.0/cli/php.ini with new version
Setting up libapache2-mod-php7.0 (7.0.32-0ubuntu0.16.04.1) ...
Creating config file /etc/php/7.0/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0
It is not managed by dpkg:
dpkg -S /etc/php/7.0/apache2/php.ini
dpkg-query: no path found matching pattern /etc/php/7.0/apache2/php.ini
But by ucf
# ucfq /etc/php/7.0/apache2/php.ini
Configuration file Package Exists Changed
/etc/php/7.0/apache2/php.ini libapache2-mod-php7 Yes No
# ucfq /etc/php/7.0/cli/php.ini
Configuration file Package Exists Changed
/etc/php/7.0/cli/php.ini php7.0-cli Yes No
The paths to those are static in the postinst files for php7.0-cli and libapache2-mod-php7, there should not be a way for them to conflict.
The only way I can think of you will hit your error being:
"ucfr: Attempt from package php7.0-cli to take /etc/php/7.0/apache2/php.ini away from package libapache2-mod-php7.0"
Is that someone (or a scri?) had accidentially set up symlinks, so that effectively
/etc/php/7.0/apache2/php.ini
and
/etc/php/7.0/cli/php.ini
are the same file.
From ucfr man page:
Where Package is the package associated with the configuration file (and, in some sense, its owner), and Path to configuration file is the full path to the location (usually under /etc) where the configuration file lives, and is potentially modified by the end user. Please note that usually this means that we register actual files, and not symbolic links to files. ucfr will follow symbolic links and register the real file, and not the symbolic link.
That said, the only way I can see the error happening is a misconfiguration - the issue should go away when this is resolved on your system.
libapache2- mod-php7. 0 is depending on php7.0-cli so they should always be installed together and the latter package should be installed first.
They both have a php.ini file, but it would be different.
libapache will always try to provide its bits to is on an install: "/etc/php/ 7.0/apache2/ php.ini" php/7.0/ php.ini- production $phpini mod-php7. 0 $phpini
phpini=
ucf /usr/lib/
it then registers itself with the file
ucfr libapache2-
php7.0-cli essentially does the same calls as above but with package name "php7.0-cli" and the path is different. "/etc/php/ 7.0/cli/ php.ini"
phpini=
I ran an install of the packages on Xenial and it seems to work fine that way: 0ubuntu0. 16.04.1) ... alternatives: using /usr/bin/php7.0 to provide /usr/bin/php (php) in auto mode alternatives: using /usr/bin/phar7.0 to provide /usr/bin/phar (phar) in auto mode alternatives: using /usr/bin/ phar.phar7. 0 to provide /usr/bin/phar.phar (phar.phar) in auto mode 7.0/cli/ php.ini with new version mod-php7. 0 (7.0.32- 0ubuntu0. 16.04.1) ... 7.0/apache2/ php.ini with new version
Setting up php7.0-cli (7.0.32-
update-
update-
update-
Creating config file /etc/php/
Setting up libapache2-
Creating config file /etc/php/
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0
It is not managed by dpkg: 7.0/apache2/ php.ini 7.0/apache2/ php.ini
dpkg -S /etc/php/
dpkg-query: no path found matching pattern /etc/php/
But by ucf 7.0/apache2/ php.ini 7.0/apache2/ php.ini libapache2-mod-php7 Yes No 7.0/cli/ php.ini 7.0/cli/ php.ini php7.0-cli Yes No
# ucfq /etc/php/
Configuration file Package Exists Changed
/etc/php/
# ucfq /etc/php/
Configuration file Package Exists Changed
/etc/php/
The paths to those are static in the postinst files for php7.0-cli and libapache2- mod-php7, there should not be a way for them to conflict. 7.0/apache2/ php.ini away from package libapache2- mod-php7. 0" php/7.0/ apache2/ php.ini php/7.0/ cli/php. ini
The only way I can think of you will hit your error being:
"ucfr: Attempt from package php7.0-cli to take /etc/php/
Is that someone (or a scri?) had accidentially set up symlinks, so that effectively
/etc/
and
/etc/
are the same file.
From ucfr man page:
Where Package is the package associated with the configuration file (and, in some sense, its owner), and Path to configuration file is the full path to the location (usually under /etc) where the configuration file lives, and is potentially modified by the end user. Please note that usually this means that we register actual files, and not symbolic links to files. ucfr will follow symbolic links and register the real file, and not the symbolic link.
That said, the only way I can see the error happening is a misconfiguration - the issue should go away when this is resolved on your system.