简体   繁体   English

PHP 在 PHP.ini 中启用 bz2 扩展

[英]PHP Enable bz2 Extension In Php.ini

I an trying to download a file using composer in php, but the file needs to be decompress with bzipped.我试图在 php 中使用 composer 下载一个文件,但该文件需要用 bzip 解压。 Here is the error I get:这是我得到的错误:

[UnexpectedValueException]                                                   
unable to decompress bzipped phar archive "/home/admin/public_html/subdo  
mains/testing4/vendor/jakoch/phantomjs/da2db411008833dfaa24e92e129aa037.bz2  
" to temporary file, enable bz2 extension in php.ini   

In my php.ini file I have added:在我的 php.ini 文件中,我添加了:

extension = "bz2.so" 

After adding that I still get the error when I try and install the file.添加后,当我尝试安装文件时仍然出现错误。

When I run infophp(-1) I get:当我运行 infophp(-1) 时,我得到:

bzip2 compression   disabled (install pecl/bz2)

Do I need to enable bzip2?我需要启用 bzip2 吗? If so how do I do it.如果是这样,我该怎么做。 Am I doing something wrong with allowing the extension?我在允许扩展时做错了什么吗?

You can install this as php extension easily.您可以轻松地将其安装为 php 扩展。

apt-get install php5.6-bz2
  • php(yourversion)-bz2 php(你的版本)-bz2

Source来源

Enabling an extention in PHP is not only by including it into php.ini file, you need to recompile your PHP installation with package support being enabled, in order to do this for bz2, you have to execute the needed pecl command:在 PHP 中启用扩展不仅是通过将其包含到php.ini文件中,您还需要在启用包支持的情况下重新编译 PHP 安装,为了对 bz2 执行此操作,您必须执行所需的 pecl 命令:

pecl install bz2

To install pecl you have to install pear and phpize , on a debian based system, the following command should be sufficint:要安装pecl您必须安装pearphpize ,在基于 debian 的系统上,以下命令应该足够了:

apt-get install php5-dev php-pear

Finally you need to add the new extension to php.ini file, Don't forget to reload your web server after that.最后,您需要将新扩展名添加到php.ini文件中,之后不要忘记重新加载您的 Web 服务器。

HTH HTH

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM