我正在使用 zipper 在 laravel 5.3 中创建 zip 文件, 得到错误为 ,
错误:您的 PHP 版本未使用 zip 支持进行编译
PHP版本:5.6
chmod($withdrawalFilePath, 0777);
$files = glob($withdrawalFilePath . '/*');
Zipper::make($withdrawalFilePath . '/Withdrawal.zip')->add($files)->close();
chmod($withdrawalFilePath . '/Withdrawal.zip', 0777);
我最近遇到了这个问题,并通过安装
php-zip
扩展来解决它。
确保在安装扩展后重新启动 apache,以便正确加载。
我在运行 amazon linux ami 的 amazon ec2 实例上使用 php 7。 我使用的命令是:
sudo yum install php70-zip && sudo service httpd restart
命令会有所不同,具体取决于您拥有的 php 版本以及您使用的 Linux 发行版。