Unable to successfully install PHP 7.4 Zip extension on Ubuntu 20.04
P粉225961749
P粉225961749 2023-08-26 11:56:12
0
1
564
<p>While running <code>sudo apt-get install php7.4-zip</code>, I encountered the following error: </p> <blockquote> <p>The following packages have unmet dependencies: php7.4-zip: Depends on php7.4-common (=7.4.3-4ubuntu2.12), but to install version 7.4.10-1 ubuntu18.04.1 deb.sury.org 1 E: The problem cannot be corrected. There are corrupt packages on your system. </p> </blockquote> <p>The page in the PHP manual about installing the Zip extension is as follows: </p> <blockquote> <p> Starting with PHP 7.4.0, in order to use these functions, you must compile PHP with zip support using the --with-zip configuration option. Previously, zip support had to be enabled using the --enable-zip configuration option. Starting with PHP 7.4.0, the bundled libzip has been removed. </p> </blockquote> <p>Is there any direct way to install the Zip extension on my system? </p> <p>Update: Additional information: </p> <ul> <li><code>dpkg --get-selections | grep hold</code>Returns packages that are not retained. </li> <li><code>sudo apt autoremove</code> removed some packages, but did not change the message returned by <code>sudo apt install php7.4-zip</code>. </li> </ul></p>
P粉225961749
P粉225961749

reply all(1)
P粉529245050

The following steps work fine on my Ubunut 22 and php7.4. Add PPA to get PHP 7.4 which also contains other required PHP extensions.

apt install software-properties-common
add-apt-repository ppa:ondrej/php  
apt update

You can then install the extension

apt install php7.4-zip
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template