When I try to run a PHP scripts I get the following errors:
Warning: PHP Startup: Unable to load dynamic library '/home/user/php-5.4.28/installdir/include/php/ext/php_bz2.so' - /home/user/php-5.4.28/installdir/include/php/ext/php_bz2.so: cannot open shared object file: No such file or directory in Unknown on line 0
php.ini:
extension_dir = "/home/user/php-5.4.28/installdir/include/php/ext"
Content at extension_dir path:
~/php-5.4.28/installdir/include/php/ext$ ls
date ereg gd iconv libxml mysqli pcre session sqlite3 xml
dom filter hash json mbstring mysqlnd pdo spl standard
Where do I locate the extension? I have installed PHP from source. All the errors and phpinfo() can be seen here on JSBin
You don't have to locate the extension. You have to recompile PHP passing the option --with-bz2
to the ./configure
script. Bzip2 support is not enabled by default as official documentation says.
./configure --with-bz2
Keep in mind that in order to compile PHP with this extension you need development headers and/or libraries. If they are missing ./configure
will fail saying what's missing. If this will happen simply use your package manager (apt, yum or zypper - distro dependent) to install required packages and retry.
It's also likely that your PHP apps are using other extensions. The procedure is exactly the same. You just add more options. Let's say that curl is also needed, then:
./configure --with-bz2 --with-curl
will work - again more headers and packages needed.
Remember to always use all the options you need as the results of former compilations are overwritten.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.