Centos 下 安装 PHP + Nginx + Sql server

前端之家收集整理的这篇文章主要介绍了Centos 下 安装 PHP + Nginx + Sql server前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.安装前必要配置

1.1 安装epel 仓库(因为CentOs6默认的yum源没有libmcrypt-devel这个包)

yum install -y epel-release

1.2 安装必要扩展

sudo yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel gcc libmcrypt-devel

2.安装PHP

2.1 下载PHP-7.1.15

wget -c http://cn2.PHP.net/get/PHP-7.1.15.tar.gz/from/this/mirror -O PHP-7.1.15.tar.gz

2.2 解压 PHP-7.1.15.tar.gz

tar -zxvf  PHP-7.1.15.tar.gz

2.3 进入 PHP-7.1.15

cd PHP-7.1.15

2.4 .编译与安装

./configure \
--prefix=/usr/local/PHP \
--with-config-file-path=/etc \
--enable-fpm \
--with-fpm-user=Nginx  \
--with-fpm-group=Nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared  \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir  \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-MysqLi=MysqLnd \
--with-pdo-MysqL=MysqLnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets  \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-MysqLnd-compression-support \
--with-pear \
--enable-opcache

sudo make && make install

这里需要一点时间

2.4 .配置PHP-fpm

sudo cp PHP.ini-production /etc/PHP.ini
sudo cp /usr/local/PHP/etc/PHP-fpm.conf.default /usr/local/PHP/etc/PHP-fpm.conf
sudo cp /usr/local/PHP/etc/PHP-fpm.d/www.conf.default /usr/local/PHP/etc/PHP-fpm.d/www.conf
sudo cp sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm
sudo chmod +x /etc/init.d/PHP-fpm

2.5 .启动PHP-fpm

···
/etc/init.d/PHP-fpm start

3.安装Nginx

3.1 下载Nginx

wget http://Nginx.org/download/Nginx-1.13.9.tar.gz

3.2 安装Nginx

tar -zxvf Nginx-1.13.9.tar.gz

cd Nginx-1.13.9

./configure --prefix=/usr/local/Nginx

3.2 启动Nginx

sudo /usr/local/Nginx/sbin/Nginx 

sudo /usr/local/Nginx/sbin/Nginx -s reload

sudo /usr/local/Nginx/sbin/Nginx -s stop

4.安装FreeTDS

4.1 下载FreeTDS

wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz

4.2 安装FreeTDS

需要注意的就是这里的--with-tdsver=7.1,这个非常重要
tar -zxvf freetds-0.91.tar.gz

cd freetds-0.91

./configure --prefix=/usr/local/freetds --with-tdsver=7.1 --enable-msdblib

make && make install

4.3 验证FreeTDS

/usr/local/freetds/bin/tsql -C

/usr/local/freetds/bin/tsql -H 数据库服务器IP -p 1433 -U 用户名 -P 密码

4.4 添加PHP扩展pdo_dblib

cd ../PHP-7.1.15/ext/pdo_dblib

/usr/local/PHP/bin/PHPize

./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config --with-pdo-dblib=/usr/local/freetds/

make && make install

4.5 在PHP.ini增加pdo_dblib.so

extension ="pdo_dblib.so"

原文链接:/centos/374659.html

猜你在找的CentOS相关文章