doukang7858 2018-02-16 10:48 采纳率: 0%
浏览 1245

求助:找不到ZipArchive但似乎已安装(PHP 7.2)

我正在一个 Amazon EC2实例(Amazon Linux 2)上安装一个需要 ziparchave 的 CMS。需求向导说不支持 ziparchave。

但是如果我按照在网上找到的说明安装 ziparchave,服务器会告诉我它已经安装了:

[ec2-user@ip-***-**-**-** ~]$ sudo yum install php-zip
Loaded plugins: langpacks, priorities, update-motd
amzn2-core                                                                                                                                                                         | 2.0 kB  00:00:00     
Package matching php-common-5.4.16-43.amzn2.0.1.x86_64 already installed. Checking for update.
Nothing to do

我已经重新启动了httpd服务。

我也尝试过:

[ec2-user@ip-***-**-**-** ~]$ sudo yum install php7.0-zip
Loaded plugins: langpacks, priorities, update-motd
amzn2-core                                                                                                                                                                         | 2.0 kB  00:00:00     
No package php7.0-zip available.
Error: Nothing to do

我也曾尝试补充 extension=zip.so 到php.ini并重新启动httpd服务,但还是没用。

zipparchave 的 PHP 手册中说:“为了使用这些函数,必须使用——enable-zip configure 选项编译支持 zip 的 PHP。”我不知道何时何地该这么做,所以我只是简单地使用了:

yum install php php-mysql

我花了将近一天的时间来解决这个问题,我不知道接下来该怎么办。谁能告诉我正确的方向?

  • 写回答

2条回答 默认 最新

  • dongranding3909 2018-03-06 23:11
    关注

    I had the same problem (Amazon Linux 2 AMI) trying to install Laravel. The problem is that this AMI uses libzip 0.10.1 while at least 0.11 is required, and if you check in your extension folder (in this AMI: /usr/lib64/php/modules), the file zip.so is missing. So, if you enable the extension in your php.ini file, you'll get an error in apache's log. I solved the issue using Remi's RPM repository to install libzip 1.1.3. This is what I did:

    1. install epel repo (needed to install Remi's RPM)
    2. install Remi's repo
    3. install libzip from the repo. You can check the new libzip version, ie:

      $ yum list "*libzip*"
      Installed Packages
      libzip-last.x86_64         1.1.3-1.el7.remi            installed
      
    4. Now that you have a compatible libzip, you can compile the zip extension: download the package from PECL in your tmp folder, extract the files and from the package root:

      $ sudo phpize
      $ sudo ./configure
      $ sudo make
      $ sudo make install
      
    5. after the make install command, the output should be:

      Installing shared extensions:     /usr/lib64/php/modules/
      

      and if you go in that dir, now you should finally see the zip.so file.

    6. Change your php.ini adding

      extension=zip
      
    7. Restart webserver and check your php info. This is what I see in mine:

      Zip enabled
      Zip version 1.15.2
      Libzip version  0.11.2
      

    In my case I was able to install laravel.

    评论

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后的密码
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面