PHP 扩展安装
php7.0中默认的扩展很少,需要我们单独去开启。
安装依赖:
apt-get install php-dev
Swoole
wgat https://github.com/swoole/swoole-src/archive/v2.0.5.tar.gzcd swoole phpize ./configure make && make install
编译安装成功后,修改php.ini加入
extension=swoole.so
Redis
apt-get install redis-server
安装PHP扩展
apt-get install php-redis
Memcache
apt-get install memcached
安装 Memcache 扩展
apt-get install php-memcache
MongoDB
apt-get install mongodb
安装 MongoDB 扩展
wget http://pecl.php.net/get/mongodb-1.2.2.tgz tar -zxvf mongodb-1.2.2.tgz cd mongodb-1.2.2 phpize ./configure make && make install
执行以上命令后,你需要修改php.ini文件,在php.ini文件中添加mongo配置,配置如下:
extension=mongo.so
注:configure: error: Cannot find OpenSSL’s libraries解决办法
apt-get install pkg-config
附上其他扩展
sudo apt install php7.0 #按tab 可以显示如下一些库 php7.0-bcmath php7.0-cli php7.0-dba php7.0-fpm php7.0-imap php7.0-json php7.0-mcrypt php7.0-opcache php7.0-pspell php7.0-snmp php7.0-sybase php7.0-xmlrpc php7.0-bz2 php7.0-common php7.0-dev php7.0-gd php7.0-interbase php7.0-ldap php7.0-mysql php7.0-pgsql php7.0-readline php7.0-soap php7.0-tidy php7.0-xsl php7.0-cgi php7.0-curl php7.0-enchant php7.0-gmp php7.0-intl php7.0-mbstring php7.0-odbc php7.0-phpdbg php7.0-recode php7.0-sqlite3 php7.0-xml php7.0-zip