简体   繁体   English

如何在 php 7.4 上安装 ziparchive?

[英]How can I install ziparchive on php 7.4?

I am running Virtuamin on centos 7, I am unable to install ziparchive on php 7.4, but when I switch to php 7.2, it works.我在 centos 7 上运行 Virtuamin,我无法在 php 7.4 上安装 ziparchive,但是当我切换到 php 7.2 时,它可以工作。 I need php 7.4 to work because it is faster and wordpress script need 7.3+ to work effectively.我需要 php 7.4 才能工作,因为它更快,而 wordpress 脚本需要 7.3+ 才能有效工作。

sudo apt-get install php7.4-zip

这适用于 ubuntu 18.04

This is how I installed it on my ubuntu:-这就是我在 ubuntu 上安装它的方式:-

For PHP对于 PHP

sudo apt-get install php7.0-zip

For Centos对于 Centos

You can try: yum install php-pecl-zip.x86_64

Try installing that and enabling it by running: echo "extension=zip.so" >> /etc/php.d/zip.ini

NOTE: Make sure to restart your server after install the above注意:请确保在安装上述内容后重新启动服务器

sudo /etc/init.d/apache2 restart or sudo service nginx restart

I am on Debian 9, which does not ship with PHP7.4, but it can be installed if you add the repository from Sury.我使用的是 Debian 9,它不附带 PHP7.4,但如果您从 Sury 添加存储库,则可以安装它。

sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list

After that, I ran this with success:在那之后,我成功地运行了这个:

apt install php7.4-zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  php7.4-zip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.5 kB of archives.
After this operation, 94.2 kB of additional disk space will be used.
Get:1 https://packages.sury.org/php stretch/main amd64 php7.4-zip amd64 7.4.7-1+                                                                           0~20200612.18+debian9~1.gbp671911 [20.5 kB]
Fetched 20.5 kB in 0s (149 kB/s)
Selecting previously unselected package php7.4-zip.
(Reading database ... 107553 files and directories currently installed.)
Preparing to unpack .../php7.4-zip_7.4.7-1+0~20200612.18+debian9~1.gbp671911_amd                                                                           64.deb ...
Unpacking php7.4-zip (7.4.7-1+0~20200612.18+debian9~1.gbp671911) ...
Processing triggers for libapache2-mod-php7.4 (7.4.7-1+0~20200612.18+debian9~1.g                                                                           bp671911) ...
Setting up php7.4-zip (7.4.7-1+0~20200612.18+debian9~1.gbp671911) ...
Creating config file /etc/php/7.4/mods-available/zip.ini with new version
Processing triggers for php7.4-fpm (7.4.7-1+0~20200612.18+debian9~1.gbp671911) .                                                                           ..
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Processing triggers for libapache2-mod-php7.4 (7.4.7-1+0~20200612.18+debian9~1.g                                                                           bp671911) ...
Processing triggers for php7.4-cgi (7.4.7-1+0~20200612.18+debian9~1.gbp671911) .                                                                           ..
Processing triggers for php7.4-cli (7.4.7-1+0~20200612.18+debian9~1.gbp671911) .                                                                           ..

Maybe you would like to take a look on this post: https://www.cloudbooklet.com/upgrade-php-version-to-php-7-4-on-ubuntu/也许你想看看这篇文章: https : //www.cloudbooklet.com/upgrade-php-version-to-php-7-4-on-ubuntu/

Basically, it tells you to:基本上,它告诉你:

Add PPA for PHP 7.4 Add the ondrej/php which has PHP 7.4 package and other required PHP extensions.为 PHP 7.4 添加 PPA 添加具有 PHP 7.4 包和其他所需 PHP 扩展的 ondrej/php。

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

Then you can install the extension然后你可以安装扩展

sudo apt install php7.4-zip

Or install all the commonly used ones:或者安装所有常用的:

sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Apache 上配置 PHP 7.4? - How can I configure PHP 7.4 on Apache? 在 Laragon 中启用 SSL 进行作曲家安装,PHP 7.4 - Enabling SSL in Laragon for composer install, PHP 7.4 如何在同一apache安装中同时使用PHP 4和PHP 5? - How can I use both PHP 4 and 5 with the same apache install? 如何在当前启用的PHP版本中安装imagick? - How can I install imagick in current enabled PHP version? 如何从 CentOS 7 上的 PHP 7.x 更新到 PHP 7.4 - How to Update to PHP 7.4 from PHP 7.x on CentOS 7 如何安装ghostscript与PHP和imagegick配合使用,以便将pdf文件转换为png图像 - How can I install ghostscript to work with PHP and imagegick so I can convert pdf files to png images 如何使用 Apache Server 2.4 在 PHP 7.4 中启用 openSSL? - How to enable openSSL in PHP 7.4 with Apache Server 2.4? 我如何配置xampp以安装最新版本的php version 7.1的php mongo驱动程序并从php脚本连接到mongodb - How can i configure xampp to install php mongo driver for latest version of php version 7.1 and connect to mongodb from php script 如何在 Ubuntu 14.04 上安装/启用 PHP 7.0 zip 扩展? - How can I install/enable the PHP 7.0 zip extension on Ubuntu 14.04? 如何在 Docker 容器中为 PHP 安装 mod_rewrite 模块? - How can I install mod_rewrite module for PHP in Docker container?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM