centos6.9 php7.1.16安装

前端之家收集整理的这篇文章主要介绍了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";

猜你在找的CentOS相关文章