web-dev-qa-db-ja.com

PHPをubuntu16.04にインストール中にエラーが発生する

コマンド:Sudo apt-get install php7.0

出力:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
php7.0 is already the newest version (7.0.8-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.1) ...
Error: The new file /usr/lib/php/7.0/php.ini-production does not exist!
dpkg: error processing package libapache2-mod-php7.0 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 libapache2-mod-php7.0
E: Sub-process /usr/bin/dpkg returned an error code (1)

Libapache2-mod-php7.0のインストール中

コマンド:Sudo apt-get install libapache2-mod-php7.0

出力:

 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 libapache2-mod-php7.0 is already the newest version (7.0.8-0ubuntu0.16.04.1).
 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 1 not fully installed or removed.
 After this operation, 0 B of additional disk space will be used.
 Do you want to continue? [Y/n] Y
 Setting up libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.1) ...
 Error: The new file /usr/lib/php/7.0/php.ini-production does not exist!
 dpkg: error processing package libapache2-mod-php7.0 (--configure):
  subprocess installed post-installation script returned error exit status 1
 Errors were encountered while processing:
  libapache2-mod-php7.0
 E: Sub-process /usr/bin/dpkg returned an error code (1)

この問題を解決する方法。

5
G S P

次のコマンドを実行します。

Sudo apt-get update
Sudo apt-get install --reinstall php7.0-common

それでもうまくいかない場合は、次のコマンドを実行します。

mkdir PHP
cd PHP
apt-get download php7.0-common
ar -xvf *
tar -xvf dat*
Sudo mv ./usr/lib/php/7.0/php.ini-production /usr/lib/php/7.0/php.ini-production
Sudo apt-get -f install
3
mchid