Home >Backend Development >PHP7 >Compile PHP7 extension (take memcached as an example)
This compilationPHP7Extension, taking memcached as an example
1. Enter http://pecl.php.net PHP extension library
2. Search memcached Copy the stable version source code link
3. Download to the server and decompress
4. Use phpize to create the configure file
5. Generate Makefile and compile and install
6. Expand the generated .so and introduce it into php.ini
7. Restart PHP or restart Apache
wget https://pecl.php.net/get/memcached-3.0.3.tgz tar xzf memcached-3.0.3.tgz cd memcached-3.0.3 /path/php/bin/phpize #path 为 PHP路径 ./configure --with-php-config=/path/php/bin/php-config
prompts that libmemcached is missing
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz tar xzf libmemcached-1.0.18 cd libmemcached-1.0.18 ./configure --prefix=/usr/local/libmemcached make && make install cd memcached-3.0.3 ./configure --with-php-config=/usr/local/php7/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached
Continue to report an error
./configure --with-php-config=/usr/local/php7/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl make && make install vim php.ini 加入: extension=memcached.so #或填绝对路径
Restart PHP
pkill -9 php /usr/local/php7/sbin/php-fpm
Check the phpinfo page and you can see memcached The extension was successfully installed
#When compiling and installing, just fill in whatever is missing.
The above is the detailed content of Compile PHP7 extension (take memcached as an example). For more information, please follow other related articles on the PHP Chinese website!