Linux(manjaro)安装PHP以及PHP扩展(redis)

Linux(manjaro)安装PHP以及PHP扩展(redis)

编译安装

下载

wget -c http://github.itzmx.com/1265578519/kangle/master/php/7.1/7113/php-7.1.13.tar.bz2 -O php-7.1.13.tar.bz2

编译

./configure --prefix=/vhs/kangle/ext/tpl_php7113 --with-config-file-scan-dir=/vhs/kangle/ext/tpl_php7113/etc/php.d --with-libdir=lib64 --with-mysqli --with-pdo-mysql --with-iconv-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/include/libxml2/libxml --enable-xml --disable-fileinfo --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pear --with-gettext --enable-calendar --with-openssl
#make
make -j 4
#install
sudo make install

安装之后
* 目录是/vhs/kangle/ext/tpl_php7113
* 配置文件目录是/vhs/kangle/ext/tpl_php7113/etc/php.d
其他扩展(伪代码)

wget -c http://github.itzmx.com/1265578519/kangle/master/php/7.1/7113/ioncube-$ZEND_ARCH-7.1.zip
unzip ioncube-$ZEND_ARCH-7.1.zip
mkdir -p $PREFIX/ioncube
mv ioncube_loader_lin_7.1.so $PREFIX/ioncube/ioncube_loader_lin_7.1.so
#install apcu
wget -c http://github.itzmx.com/1265578519/kangle/master/php/7.1/7113/apcu-5.1.9.tgz
tar zxf apcu-5.1.9.tgz
cd apcu-5.1.9
/vhs/kangle/ext/tpl_php7113/bin/phpize
./configure --with-php-config=/vhs/kangle/ext/tpl_php7113/bin/php-config
make -j 4
make install
cd ..
#install libmemcached
wget -c http://github.itzmx.com/1265578519/kangle/master/php/7.1/7113/libmemcached-1.0.18.tar.gz
tar -zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure
make -j 4
make install
cd ..
#install memcached
wget -c http://github.itzmx.com/1265578519/kangle/master/php/7.1/7113/php-memcached-3.1.0-dev.zip
unzip -o php-memcached-3.1.0-dev.zip
cd php-memcached-3.1.0-dev
/vhs/kangle/ext/tpl_php7113/bin/phpize
./configure --with-php-config=/vhs/kangle/ext/tpl_php7113/bin/php-config --disable-memcached-sasl
make -j 4
make install

pacman安装

直接安装php,默认是最高版本

sudo pacman -S php php-cgi

查看php的安装目录位置

[lxx@lxx-pc gitee]$ whereis php
php: /usr/bin/php /usr/lib/php /etc/php /usr/include/php /usr/share/man/man1/php.1.gz

安装php扩展redis
可以参考kangle php安装redis扩展

#下载
wget https://github.com/phpredis/phpredis/archive/4.0.2.tar.gz
tar -zxf 4.0.2.tar.gz
cd phpredis-4.0.2
#在这里执行
/usr/bin/phpize
#初始化
./configure --with-php-config=/usr/bin/php-config
make
sudo make install

生成扩展的目录

[lxx@lxx-pc phpredis-4.0.2]$ ls /usr/lib/php/modules/
bcmath.so    curl.so  ftp.so      iconv.so   opcache.so    shmop.so    sysvmsg.so  xmlrpc.so
bz2.so       dba.so   gettext.so  ldap.so    pdo_mysql.so  soap.so     sysvsem.so  zip.so
calendar.so  exif.so  gmp.so      mysqli.so  redis.so      sockets.so  sysvshm.so

配置扩展

sudo nano /etc/php/php.ini
#添加
extension=/usr/lib/php/modules/redis.so

你可能感兴趣的:(php,manjaro)