apache 如何在php 7.4上安装ziparchive?

snz8szmq  于 2023-10-23  发布在  Apache
关注(0)|答案(5)|浏览(243)

我在centos 7上运行Virtuamin,我无法在php 7.4上安装ziparchive,但当我切换到php 7.2时,它可以工作。我需要php 7.4的工作,因为它是更快和wordpress脚本需要7.3+有效地工作。

x6h2sr28

x6h2sr281#

  1. sudo apt-get install php7.4-zip

在ubuntu 18.04中运行

mftmpeh8

mftmpeh82#

也许你想看看这篇文章:https://www.cloudbooklet.com/upgrade-php-version-to-php-7-4-on-ubuntu/
基本上,它告诉你:
添加PPA for PHP 7.4添加包含PHP 7.4包和其他必需PHP扩展的ondrej/php。

  1. sudo apt install software-properties-common
  2. sudo add-apt-repository ppa:ondrej/php
  3. sudo apt update

然后你就可以安装扩展了

  1. sudo apt install php7.4-zip

或者安装所有常用的:

  1. 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
6jygbczu

6jygbczu3#

这是我在ubuntu上安装的方法:
For PHP

  1. sudo apt-get install php7.0-zip

对Centos

  1. You can try: yum install php-pecl-zip.x86_64
  2. Try installing that and enabling it by running: echo "extension=zip.so" >> /etc/php.d/zip.ini

注意:安装上述软件后,请务必重新启动服务器

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

polkgigr

polkgigr4#

我在Debian 9上,它没有随PHP7.4一起提供,但如果您从Sury添加存储库,则可以安装它。

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

在那之后,我成功地运行了这个:

  1. apt install php7.4-zip
  2. Reading package lists... Done
  3. Building dependency tree
  4. Reading state information... Done
  5. The following NEW packages will be installed:
  6. php7.4-zip
  7. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  8. Need to get 20.5 kB of archives.
  9. After this operation, 94.2 kB of additional disk space will be used.
  10. 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]
  11. Fetched 20.5 kB in 0s (149 kB/s)
  12. Selecting previously unselected package php7.4-zip.
  13. (Reading database ... 107553 files and directories currently installed.)
  14. Preparing to unpack .../php7.4-zip_7.4.7-1+0~20200612.18+debian9~1.gbp671911_amd 64.deb ...
  15. Unpacking php7.4-zip (7.4.7-1+0~20200612.18+debian9~1.gbp671911) ...
  16. Processing triggers for libapache2-mod-php7.4 (7.4.7-1+0~20200612.18+debian9~1.g bp671911) ...
  17. Setting up php7.4-zip (7.4.7-1+0~20200612.18+debian9~1.gbp671911) ...
  18. Creating config file /etc/php/7.4/mods-available/zip.ini with new version
  19. Processing triggers for php7.4-fpm (7.4.7-1+0~20200612.18+debian9~1.gbp671911) . ..
  20. NOTICE: Not enabling PHP 7.4 FPM by default.
  21. NOTICE: To enable PHP 7.4 FPM in Apache2 do:
  22. NOTICE: a2enmod proxy_fcgi setenvif
  23. NOTICE: a2enconf php7.4-fpm
  24. NOTICE: You are seeing this message because you have apache2 package installed.
  25. Processing triggers for libapache2-mod-php7.4 (7.4.7-1+0~20200612.18+debian9~1.g bp671911) ...
  26. Processing triggers for php7.4-cgi (7.4.7-1+0~20200612.18+debian9~1.gbp671911) . ..
  27. Processing triggers for php7.4-cli (7.4.7-1+0~20200612.18+debian9~1.gbp671911) . ..
展开查看全部
hiz5n14c

hiz5n14c5#

实际上,这取决于您使用的PHP版本。一般来说,你会期望这是所有需要的,特别是因为它运行:sudo apt-get install php-zip,但这对我不起作用。该解决方案依赖于PHP版本。
对于目前可用的三个主要PHP版本,这里的最后一个(实际上与我的8.1版本相匹配)对我来说是有效的:

PHP 5.6

  1. sudo apt-get install php5.6-zip

PHP 7.0

  1. sudo apt-get install php7.0-zip

PHP 8.0

  1. sudo apt-get install php8.0-zip

安装后别忘了重启apache!

其中一个应该重新启动Apache:

  1. systemctl restart apache2
  2. /etc/init.d/apache2 restart
  3. sudo service apache2 graceful
展开查看全部

相关问题