Do not recompile php install zlib extensions for PHP-Learn to collect ____php

Source: Internet
Author: User
Tags zend

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.