Search code examples
nginxlaravel-5.1ubuntu-16.04php-7bzip2

Call to undefined function bzdecompress PHP


I have an Ubuntu 16.04 server with PHP7 + nginx running. I already have a project in PHP Laravel 5.1 running in my local enviroment (Windows with Xampp) and everything is running great. I have a PHP script that uses the function bzdecompress of Bzip2 but then, in the server just crash and show this message:

Call to undefined function App\Http\Controllers\bzdecompress() 

I don't see instructions of how install this library (if needed) or how to load it or check at least that is loaded. Thank you very much!


Solution

  • 1) check your installed packages php -m

    if bzip2 is installed move to step 3 directly , if not installed then install it by running :

    2) for php7 :

    apt-get install php7.0-bz2
    

    for php5:

    apt-get install php-bz2
    

    3) then make sure that you've enabled your extension via :

    phpenmod bz2
    

    4) then you can restart your server

    service nginx restart