A server that compiles PHP without setting parameters, resulting in the lack of zlib extensions, unable to perform decompression, the error message is: "Fatal error:call to undefined function Gzopen".
First to find the original compiled PHP directory, if not to find a similar version of the decompression, decompression to the PHP (assuming) directory, and then as root into the php/ext/zlib/directory
Execute phpize, Error: "Cannot find config.m4.", I looked for a half-day did not find this file, but see a similar "CONFIG0.M4", on the CP A:
CP CONFIG0.M4 CONFIG.M4
This solution is a little cottage, I do not know what the meaning, why a 0 more, anyway, I measured the ability to do.
Again executes phpize, again error: "Cannot find autoconf." Please check your autoconf installation and the $PHP _autoconf environment variable. Then, rerun this script. "
It turns out that autoconf does not exist and is installed through Yum:
Yum-y Install autoconf
And then execute phpize, well, I'll never break your dog's leg. The smooth execution is over.
# phpize
configuring for:
PHP API Version: 20100412
Zend Module API No: 20100525
Zend Extension Api No: 220100525
In this directory, a configure script is generated, and the following code is executed to get the location of the Php-config script standby:
# which Php-config
/usr/local/bin/php-config (This is not necessarily the result on your computer)
The following code is then executed to get the zlib location standby:
# Find/-name zlib.h
/usr/include/zlib.h
When you're ready, you start to perform the configuration.
./configure--with-php-config=/usr/local/bin/php-config--with-zlib=/usr
Note:--WITH-ZLIB=/USR here do not need to write the file directory, write here on the line, PHP extension in the compile is this virtue, habit is good.
Then there is the formal compilation and installation:
Make && make install
If it goes well, it will eventually prompt:
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20100525/
And then at the end of the php.ini, add this sentence:
Extension=zlib.so
Restart the PHP CGI or fastcgi or PHP-FPM, and specifically reboot what depends on how the server runs PHP.
If all goes well, you can see zlib information in Phpinfo, which proves that PHP's zlib extension has been successfully installed.