1

I have a program that requires PHP to be configured --with-zlib, so I re-ran ./configure, make and sudo make install PHP 5.6.15 on my Ubuntu 14.04 server. However, the program still says that PHP wasn't compiled with zlib. phpinfo() shows

Configure Command: './configure' '--with-mysqli' '--with-pdo-mysql' '--enable-fpm' '--with-mysql'

even though I used the --with-zlib flag. Running php -m lists zlib as a module. My php.ini has both zlib.output_compression = On and zlib.output_handler = On. I've tried restarting PHP-FPM, nginx, and the server itself.

One attempted solution: the first time I tried this, it seems that ./configure was caching my first configuration without zlib. I re-extracted PHP to make sure this wasn't the case, and did everything again. I think it was done correctly this time.

I thought that perhaps my command-line PHP and the PHP running on the webserver were using different configurations, but it doesn't seem that way. My PHP info page shows that I'm using the php.ini in /usr/local/lib, and php -i | grep 'php.ini' shows the same.

Any idea what could be going wrong?

There's a gist of my config.log here.

Solution: The issue was that php-fpm wasn't running, but instead of notifying me, I assume nginx served up a cached page showing an old phpinfo().

10
  • Is libz-dev installed? Run ./configure --with-mysqli --with-pdo-mysql --enable-fpm --with-mysql --with-zlib > output.txt, then check output.txt to see if the config script found zlib libraries. If not, you need to do sudo apt-get install libz-dev
    – Gmck
    Commented Nov 17, 2015 at 0:20
  • It's already installed. ./configure gives the line checking for zlib version >= 1.2.0.4... 1.2.8 and if I try to install libz-dev anyway, I'm told Note, selecting 'zlib1g-dev' instead of 'libz-dev' and zlib1g-dev is already the newest version.
    – tao_oat
    Commented Nov 17, 2015 at 21:12
  • In some cases, you have to include --with-libdir=[location] for the configure script to find the libs. In your comment, you did not indicate if there was a "Yes" after checking for zlib version >= 1.2.0.4... 1.2.8`.
    – Gmck
    Commented Nov 20, 2015 at 18:15
  • There's no Yes after checking for zlib version >= 1.2.0.4... 1.2.8 - I took it to mean that it found a version greater than 1.2.0.4, namely version 1.2.8! I've tried with a few different locations for both --with-libdir and --with-zlib-dir, such as /usr, /usr/local, /usr/share, /usr/src/linux-headers-3.13.0-57 (because that's where zlib.h is) but none of them change the output of ./configure. Am I trying the wrong directories, or does the error perhaps lie somewhere else?
    – tao_oat
    Commented Nov 21, 2015 at 19:53
  • I just tried the configure on one of my servers. What you should see is checking for gzgets in -lz... yes which is the test the configure script runs to see if libz is working. If you get a ...yes, then the library was found. I checked my box and see the header in /usr/include/zlib.h and the libs in /usr/lib/x86_64-linux-gnu/libz.a and .so
    – Gmck
    Commented Nov 23, 2015 at 20:03

0

You must log in to answer this question.

Browse other questions tagged .