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

FAQ
It is currently Tue Jun 06, 2023 8:52 am


Author Message
mandrei99
Post  Post subject: PHP Fatal error: Call to undefined function gzencode() - missing zlib support  |  Posted: Sat Jan 17, 2015 5:14 pm

Joined: Tue Aug 04, 2009 9:16 am
Posts: 250

Offline
 

PHP Fatal error: Call to undefined function gzencode() - missing zlib support

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:

Code:
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 ./zlib.la /usr/src/php-5.6.4/ext/zlib/modules
cp ./.libs/zlib.so /usr/src/php-5.6.4/ext/zlib/modules/zlib.so
cp ./.libs/zlib.lai /usr/src/php-5.6.4/ext/zlib/modules/zlib.la
PATH="$PATH:/sbin" ldconfig -n /usr/src/php-5.6.4/ext/zlib/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/src/php-5.6.4/ext/zlib/modules

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/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) 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:
Code:
extension=zlib.so

Let's confirm using cli php:
Code:
root@server:/usr/src/php-5.6.4/ext/zlib# /opt/php/bin/php -i | grep -i "zlib sup"
ZLib Support => enabled





Google reCaptcha - An internal error occurred.


Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "PHP Fatal error: Call to undefined function gzencode() - missing zlib support"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Google reCaptcha - An internal error occurred

mandrei99

0

13134

Thu Jan 15, 2015 9:38 pm

mandrei99 View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cronNews 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 ]



phpBB SEO