Home > Backend Development > PHP7 > body text

Compile PHP7 extension (take memcached as an example)

藏色散人
Release: 2023-02-17 13:46:02
forward
2318 people have browsed it

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
Copy after login

prompts that libmemcached is missing

Compile PHP7 extension (take memcached as an example)

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
Copy after login

Continue to report an error

Compile PHP7 extension (take memcached as an example)

./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 #或填绝对路径
Copy after login

Compile PHP7 extension (take memcached as an example)

Restart PHP

pkill -9 php
/usr/local/php7/sbin/php-fpm
Copy after login

Check the phpinfo page and you can see memcached The extension was successfully installed

Compile PHP7 extension (take memcached as an example)

#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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template