Home > Article > Backend Development > How to use phpize
phpize is used to extend PHP extension modules. PHP plug-in modules can be built through phpize. Here is a method of using it. Friends who need it can refer to it.
When installing (fastcgi mode), there is often such a command:
The code is as follows:
/usr/local/webserver/php/bin/phpize
1. What does phpize do?
What is phpize?
phpize is used to extend PHP extension modules. PHP plug-in modules 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 and work through the following steps.
2. How to use phpize?
When php is compiled, there will be a phpize script file in the bin directory of php. Before compiling the extension module you want to add, just execute the following phpize;
For example, if you want to add the memcache extension module to php now: all we have to do is the following steps
The code is as follows:
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 after ./configure you can specify the path to the php-config file
In this way, the compilation is complete. What still needs to be done is to add the extension value to the php.ini file
The code is as follows:
extension = “memcache.so”
Note: Cannot find config.m4.
This error is a silly mistake. You need to cd to the folder after decompression, otherwise phpize will report an error
Dynamic When compiling PHP's memcache extension library, an error occurred when executing /usr/localphp/bin/phpize. The code is as follows:
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.
Obviously the files are missing and need to be installed.
The code is as follows:
# 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