从14.04升级到16.04后,php7安装失败

从14.04升级到16.04后,php7安装失败

我想从 14.04 升级到 16.04 后安装 php7。以下是我得到的结果:

Setting up php7.0-fpm (7.0.8-0ubuntu0.16.04.2) ...
Job for php7.0-fpm.service failed because the control process exited with error code. See "systemctl status php7.0-fpm.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript php7.0-fpm, action "start" failed.
    dpkg: error processing package php7.0-fpm (--configure):
     subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
     php7.0-fpm
    E: Sub-process /usr/bin/dpkg returned an error code (1)

的输出sudo php-fpm7.0 -t为:

[07-Aug-2016 10:32:35] ERROR: failed to open configuration file '/etc/php/7.0/fpm/php-fpm.conf': No such file or directory (2)
[07-Aug-2016 10:32:35] ERROR: failed to load configuration file '/etc/php/7.0/fpm/php-fpm.conf'
[07-Aug-2016 10:32:35] ERROR: FPM initialization failed

答案1

对造成的不便表示歉意,

笔记:我在 14.04 中使用了 php7,然后将其删除并再次安装 php5。现在我想再次安装 php7。

解决此问题:

  1. 删除 php7.0-fpm:sudo apt-get remove php7.0-fpm
  2. 清除它:sudo apt-get purge php7.0-fpm
  3. 手动删除 /etc/php/7.0/fpm 目录:sudo rm -rf /etc/php/7.0/fpm/
  4. 再次安装php7.0-fpm:sudo apt-get install php7.0-fpm

相关内容