0

I need to enable bzip2 compression on a centOS server. Let me walk you through what I did so far:

When running composer install I get the following errors:

Problem 1
  - Installation request for jakoch/phantomjs-installer 2.1.1-p08 -> satisfiable by jakoch/phantomjs-installer[2.1.1-p08].
  - jakoch/phantomjs-installer 2.1.1-p08 requires ext-bz2 * -> the requested PHP extension bz2 is missing from your system.
Problem 2
  - jakoch/phantomjs-installer 2.1.1-p08 requires ext-bz2 * -> the requested PHP extension bz2 is missing from your system.
  - josh/php-phantomjs v4.6.2 requires jakoch/phantomjs-installer 2.1.1-p08 -> satisfiable by jakoch/phantomjs-installer[2.1.1-p08].
  - Installation request for josh/php-phantomjs v4.6.2 -> satisfiable by josh/php-phantomjs[v4.6.2].

To enable extensions, verify that they are enabled in your .ini files:
  - /usr/local/lib/php.ini
  - /usr/local/lib/php.conf.d/50-webapps.ini

I uncommented the extension line of bz2 in php.ini file:

extension=bz2

and restarted apache. After running php --ini I get the following message:

Unable to load dynamic library 'bz2' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/bz2 (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/bz2: cannot open shared object file: No such file or directory)...

Which is true because there is no bz2.so file inside extensions/no-debug-non-zts-20170718/ directory.

I searched a lot about how to install bzip2 extension for php but could not find any solutions. Also bzip2 is already installed on the machine.

I was thinking maybe finding a bz2.so file and putting in extensions directory could fix the problem but again could not find the file either!

Any idea how to enable this extension (and others like php soap) on server?

Ulrich Eckhardt
  • 16,572
  • 3
  • 28
  • 55
Donomron
  • 195
  • 3
  • 17
  • `sudo yum install bzip2` maybe? – AbraCadaver Oct 28 '19 at 13:02
  • @AbraCadaver `bzip2` is already installed on the server. I wonder maybe php extensions are different from local packages. – Donomron Oct 28 '19 at 13:04
  • Did you search available packages for a bz2 or bzip2 library for use with PHP? Did you browse available packages for available PHP extensions? – Ulrich Eckhardt Oct 28 '19 at 13:07
  • I have never used it, but found this https://www.php.net/manual/en/bzip2.installation.php Looks like PHP needs to be compiled with bz2 support. – AbraCadaver Oct 28 '19 at 13:08
  • Can you verify if this server utilizes cPanel w/EasyApache and if so, which version of each – BA_Webimax Oct 28 '19 at 13:20
  • @BA_Webimax Direct admin v.1.57.1 is installed on this server so EasyApache is not availavle. – Donomron Oct 28 '19 at 16:21
  • @AbraCadaver Thanks for the feedback. I've checked that before, but since this is a production server I'm not sure compiling php is the right way to do it. – Donomron Oct 28 '19 at 16:23

1 Answers1

0

this should work on PHP v7.3. in php.ini please look for "ExtensionList" many extensions are defined there, just add extension=php_bz2.dll at the end of the list you see. as you need to check if php_bz2.dll file was available in the PHP extensions folder .....\PHP\v7.3\ext\ if not, just let me know, so i could upload it for you. Then restart apache

Gamal
  • 1
  • 1