本文记录PHP常用的一些扩展的安装,PHP版本为PHP8.1
redis extension
curl -Lk --retry 3 "https://pecl.php.net/get/redis-5.3.7.tgz" | gunzip | tar x
cd redis-5.3.7
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
touch /usr/local/php/etc/php.d/redis.ini
echo 'extension=redis.so' > /usr/local/php/etc/php.d/redis.ini
cd .. ; \
swoole extension
curl -Lk --retry 3 "https://github.com/swoole/swoole-src/archive/v4.8.6.tar.gz" | gunzip | tar x
cd swoole-src-4.8.6
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-openssl --enable-mysqlnd --enable-sockets
make && make install
touch /usr/local/php/etc/php.d/swoole.ini
echo 'extension=swoole.so' > /usr/local/php/etc/php.d/swoole.ini
cd .. ; \
Install inotify
wget https://pecl.php.net/get/inotify-3.0.0.tgz
tar xf inotify-3.0.0.tgz
cd inotify-3.0.0
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
touch /usr/local/php/etc/php.d/inotify.ini
echo 'extension=inotify.so' > /usr/local/php/etc/php.d/inotify.ini
Install yaml
wget https://pecl.php.net/get/yaml-2.2.3.tgz
tar xf yaml-2.2.3.tgz
cd yaml-2.2.3
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
touch /usr/local/php/etc/php.d/yaml.ini
echo 'extension=yaml.so' > /usr/local/php/etc/php.d/yaml.ini
Install mongodb
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar xzf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure --prefix=/usr/local/libmemcached-1.0.18 --with-memcached
make && make install
wget https://pecl.php.net/get/memcached-3.2.0.tgz
tar xf memcached-3.2.0.tgz
cd memcached-3.2.0
phpize
./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached-1.0.18 --disable-memcached-sasl
make && make install
touch /usr/local/php/etc/php.d/memcached.ini
echo 'extension=memcached.so' > /usr/local/php/etc/php.d/memcached.ini
Install mongodb
wget https://pecl.php.net/get/mongodb-1.15.1.tgz
tar xf mongodb-1.15.1.tgz
cd mongodb-1.15.1
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
touch /usr/local/php/etc/php.d/mongodb.ini
echo 'extension=mongodb.so' > /usr/local/php/etc/php.d/mongodb.ini
Install mongodb
wget https://pecl.php.net/get/apcu-5.1.22.tgz
tar xf apcu-5.1.22.tgz
cd apcu-5.1.22
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
touch /usr/local/php/etc/php.d/apcu.ini
echo 'extension=apcu.so' > /usr/local/php/etc/php.d/apcu.ini