Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

It is currently Fri Oct 18, 2019 5:22 am

Message body:
Enter your message here, it may contain no more than 60000 characters. 

:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
Font size:
Font colour
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation code
Confirmation code:
In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.

Topic review - PHP Fatal error: Call to undefined function gzencode() - missing zlib support
Author Message
Post subject: PHP Fatal error: Call to undefined function gzencode() - missing zlib support  |  Post Posted: Sat Jan 17, 2015 5:14 pm
With a PHP-FPM deployment, there are two levels of compression: in php and in nginx.
Nginx comes with gzip support in all flavors of Linux. The above error occurs when php is built from source without zlib support.

Here is how to configure php zlib extension separately assuming you still have the source:

root@server:/usr/src/php-5.6.4/ext/zlib# /opt/php-5.6.4/bin/phpize
Cannot find config.m4.
Make sure that you run '/opt/php-5.6.4/bin/phpize' in the top level source directory of the module

root@server:/usr/src/php-5.6.4/ext/zlib# cp -rp config0.m4 config.m4
root@server:/usr/src/php-5.6.4/ext/zlib# /opt/php-5.6.4/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226

root@server:/usr/src/php-5.6.4/ext/zlib# ./configure --with-php-config=/opt/php-5.6.4/bin/php-config 

root@server:/usr/src/php-5.6.4/ext/zlib# make && make install
/bin/bash /usr/src/php-5.6.4/ext/zlib/libtool --mode=install cp ./ /usr/src/php-5.6.4/ext/zlib/modules
cp ./.libs/ /usr/src/php-5.6.4/ext/zlib/modules/
cp ./.libs/zlib.lai /usr/src/php-5.6.4/ext/zlib/modules/
PATH="$PATH:/sbin" ldconfig -n /usr/src/php-5.6.4/ext/zlib/modules
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and manual pages.

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /opt/php-5.6.4/lib/php/extensions/no-debug-non-zts-20131226/

Zlib is now built a shared extension for PHP (can be enabled and disabled).
Next open "php.ini" and add the following line in the "Dynamic Extensions" section and restart php:

Let's confirm using cli php:
root@server:/usr/src/php-5.6.4/ext/zlib# /opt/php/bin/php -i | grep -i "zlib sup"
ZLib Support => enabled
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list

Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]