Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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:

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:

bzip2 compression   disabled (install pecl/bz2)

Do I need to enable bzip2? If so how do I do it. Am I doing something wrong with allowing the extension?

like image 1000
Alex Pelletier Avatar asked Jul 28 '14 03:07

Alex Pelletier


People also ask

What is PHP Bz2 extension?

PHP License. Description. Bz2 is an extension to create and parse bzip2 compressed data. [ Latest Tarball ]

Where do I put PHP INI extension?

Go to your php. ini file and add the following line: extension=<extension_name>. dll. To verify that the extension was loaded properly, go to Setup | Extensions and locate the extension from the list.

How do I enable PHP extensions in Windows?

On Windows, you have two ways to load a PHP extension: either compile it into PHP, or load the DLL. Loading a pre-compiled extension is the easiest and preferred way. To load an extension, you need to have it available as a ". dll" file on your system.


2 Answers

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:

pecl install bz2

To install pecl you have to install pear and phpize, on a debian based system, the following command should be sufficint:

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.

HTH

like image 119
Ma'moon Al-Akash Avatar answered Oct 20 '22 14:10

Ma'moon Al-Akash


You can install this as php extension easily.

apt-get install php5.6-bz2
  • php(yourversion)-bz2

Source

like image 35
Viraths Avatar answered Oct 20 '22 13:10

Viraths