码迷,mamicode.com
首页 > Web开发 > 详细

centos6.9 php7.1.16安装

时间:2018-05-24 16:26:22      阅读:508      评论:0      收藏:0      [点我收藏+]

标签:php

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安装

标签:php

原文地址:http://blog.51cto.com/zuoshou/2119836

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!