我不小心升級了我的系統,而不是只是進行更新,並不是我的moodle無法工作,因為PHP被搞亂了。
它告訴我我有未滿足的依賴關係,以及 PHP5-cli 的問題。
sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.19.0-18 linux-headers-3.19.0-18-generic linux-headers-3.19.0-26
linux-headers-3.19.0-26-generic linux-headers-3.19.0-30 linux-headers-3.19.0-30-generic
linux-headers-3.19.0-31 linux-headers-3.19.0-31-generic linux-headers-3.19.0-39
linux-headers-3.19.0-39-generic linux-headers-3.19.0-42 linux-headers-3.19.0-42-generic
linux-headers-3.19.0-43 linux-headers-3.19.0-43-generic linux-headers-3.19.0-47
linux-headers-3.19.0-47-generic linux-headers-3.19.0-49 linux-headers-3.19.0-49-generic
linux-headers-4.2.0-30 linux-headers-4.2.0-30-generic linux-image-3.19.0-18-generic
linux-image-3.19.0-26-generic linux-image-3.19.0-30-generic linux-image-3.19.0-31-generic
linux-image-3.19.0-39-generic linux-image-3.19.0-42-generic linux-image-3.19.0-43-generic
linux-image-3.19.0-47-generic linux-image-3.19.0-49-generic linux-image-4.2.0-30-generic
linux-image-extra-3.19.0-18-generic linux-image-extra-3.19.0-26-generic
linux-image-extra-3.19.0-30-generic linux-image-extra-3.19.0-31-generic
linux-image-extra-3.19.0-39-generic linux-image-extra-3.19.0-42-generic
linux-image-extra-3.19.0-43-generic linux-image-extra-3.19.0-47-generic
linux-image-extra-3.19.0-49-generic linux-image-extra-4.2.0-30-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
pkg-php-tools
Suggested packages:
dh-make
The following packages will be REMOVED:
libapache2-mod-php5
The following packages will be upgraded:
pkg-php-tools
1 upgraded, 0 newly installed, 1 to remove and 318 not upgraded.
15 not fully installed or removed.
Need to get 0 B/38.2 kB of archives.
After this operation, 10.2 MB disk space will be freed.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
pkg-php-tools
Install these packages without verification? [y/N] y
(Reading database ... 560010 files and directories currently installed.)
Removing libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.2) ...
ERROR: Module php5 does not exist!
dpkg: error processing package libapache2-mod-php5 (--remove):
subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
libapache2-mod-php5
E: Sub-process /usr/bin/dpkg returned an error code (1)
我怎麼才能修復我的php?我似乎無法修復依賴關係。
運行時sudo dpkg --configure -a
我遇到很多依賴問題 - 未配置。
sudo apt-get install -f
我明白了
The following additional packages will be installed:
pkg-php-tools
Suggested packages:
dh-make
The following packages will be REMOVED:
libapache2-mod-php5
The following packages will be upgraded:
pkg-php-tools
1 upgraded, 0 newly installed, 1 to remove and 319 not upgraded.
15 not fully installed or removed.
Need to get 0 B/38.2 kB of archives.
After this operation, 10.2 MB disk space will be freed.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
pkg-php-tools
Install these packages without verification? [y/N] y
(Reading database ... 560010 files and directories currently installed.)
Removing libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.2) ...
ERROR: Module php5 does not exist!
dpkg: error processing package libapache2-mod-php5 (--remove):
subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
libapache2-mod-php5
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
我遇到了同樣的問題,在升級到 16.04 後,當這種情況開始發生時,我嘗試透過安裝基本的 LAMP 軟體包來運行 joomla。
無法安裝任何軟體包且無法刪除libapache2-mod-php5
刪除 libapache2-mod-php5
錯誤:模組 php5 不存在!
經過一番谷歌搜索和絞盡腦汁之後,我猜想 Apache 仍在使用 php5 的事實是我的問題的一部分。
我不確定這是否是解決問題的正確方法,但我設法透過執行以下操作來解決此問題:
cd /etc/apache2/mods-enabled
sudo mv php5.conf php5.conf.old
sudo mv php5.load php5.load.old
sudo apt-get purge libapache2-mod-php5
sudo apt-get update
sudo apt-get upgrade
這解決了這個問題,我可以愉快地再次安裝和刪除軟體。
也許比我聰明的人可以解釋為什麼這有效或提出一個更優雅/合適的解決方案。
無論如何,我希望這會有所幫助。
答案2
問題是您不再擁有 PHP 5 並且正在運行 PHP7 ..您可能需要為新的 PHP7 更新一些 PHP 外掛程式和檔案。 php.ini 現在位於 /etc/php/7.0 而不是 /etc/php5 .. 您可能需要更改 apache 或 Moodle 中的內容以反映此更改