centos6.9 php7.1.16安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.9 php7.1.16安装相关的知识,希望对你有一定的参考价值。

yum install -y freetype freetype-devel libxml2 libxml2-devel curl-devel libjpeg libjpeg-devel libpng libpng-devel
tar xf php-7.1.16.tar.bz2
cd php-7.1.16
vim /usr/local/apache/bin/apxs
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-maintainer-zts --enable-opcache --enable-sockets --enable-xml --enable-mbstring --enable-soap --enable-zip --enable-bcmath --with-gettext --with-openssl --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr/include/freetype2/ --with-zlib-dir=/usr/lib --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-mhash --with-apxs2=/usr/local/apache/bin/apxs
make
make install
cp php.ini-development /usr/local/php/etc/php.ini
vim /etc/profile.d/php.sh
export PATH=/usr/local/php/bin:$PATH
. /etc/profile.d/php.sh

httpd与php合作
vim /usr/local/apache/conf/httpd.conf
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

AddType application/x-httpd-php .php .html

Include conf//extra/httpd-vhosts.conf

httpd -t
service httpd restart

php安装memcache扩展
yum install unzip
unzip php7.zip
cd pecl-memcache-php7/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
vim /usr/local/php/etc/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20160303/"
extension = "memcache.so"

php安装memcached扩展
wget https://launchpadlibrarian.net/165454254/libmemcached-1.0.18.tar.gz
tar xf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure -prefix=/usr/local/libmemcached -with-memcached
make或make clean all LDFLAGS="-L/usr/lib64 -L/lib64"
make install

git clone https://github.com/php-memcached-dev/php-memcached
cd php-memcached/
/usr/local/php/bin/phpize
git checkout -b php7
./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
make
make install
vim /usr/local/php/etc/php.ini
extension = "memcached.so"

tar zxf mongo-1.6.16.tgz
cd mongo-1.6.16
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

vim /usr/local/php/etc/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20131226/"
extension = mongo.so
httpd -t
service httpd restart

<?php
// connect to mongodb
$m = new Mongoclient("mongodb://47.101.99.1:27017");
echo "Connection to database successfully<br/>";
// select a database
$db = $m->xwgl;

echo "Database xwgl selected";

以上是关于centos6.9 php7.1.16安装的主要内容,如果未能解决你的问题,请参考以下文章

安装Centos6.9出现故障

CENTOS6.9安装PYTHON-3.6.3

centos6.9系统的安装

安装Centos6.9后配置网络

CentOS6.9下安装python notebook

CentOS6.9编译安装MySQL5.7.16