php tutorial phpize usage

  • 2020-12-22 17:35:48
  • OfStack

When installing (fastcgi mode), there is usually a command like this:


/usr/local/webserver/php/bin/phpize

1. What does phpize do?

What is phpize?
phpize is used to extend the php extension module, and the plug-in module of php can be built through phpize
For example, if you want to add extension modules such as memcached or ImageMagick to the original compiled php, you can use phpize to do the following.

2. How to use phpize?

When php is compiled, the phpize script file will be in the bin directory of php. Before compiling the extension module you want to add, execute phpize;
For example, we now want to add the memcache extension module to php: All we need to do are the following steps


tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/webserver/php/bin/phpize
./configure  � with-php-config=/usr/local/webserver/php/bin/php-config
make
make install

Note that the path to the ES38en-ES39en file can be specified after /configure
This completes the compilation, all you need to do is add the extension value to the php.ini file


extension =  " memcache.so " 

Note: Cannot find config.m4.
This error is a very silly error, after decompression need cd to the folder, otherwise phpize will report an error
Dynamic compilation PHP memcache extension of library, and in the execution/usr/localphp/bin/phpize appear a mistake,

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.

Obviously files are missing and need to be installed.


# wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
# tar -zvxf m4-1.4.9.tar.gz
# cd m4-1.4.9/
# ./configure && make && make install
# cd ../
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
# tar -zvxf autoconf-2.62.tar.gz
# cd autoconf-2.62/
# ./configure && make && make install
 Then execute the following command to install 
#/usr/local/php/bin/phpize
#./configure  � prefix=/usr/local/memcached  � with-libevent=/usr/local/libevent  � with-php-config=/usr/local/php/bin/php-config
#make && make install


Related articles: