一、安装前的必要配置1.1安装epel仓库(因为CentOs6默认的yum源没有libmcrypt-devel包)yuminstall-yepel-release1.2安装必要的扩展sudoyuminstalllibxml2libxml2-developensslopenssl-develbzip2bzip2-devellibcurllibcurl-devellibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-develgmpgmp-devellibmcrypt-develreadlinereadline-devellibxsltlibxslt-develgcclibmcrypt-devel2.安装PHP2.1下载PHP-7.1.15wget-chttp://cn2.php.net/get/php-7.1.15.tar.gz/from/this/mirror-Ophp-7.1.15.tar.gz2.2解压php-7.1.15.tar.gztar-zxvfphp-7.1.15.tar.gz2.3输入php-7.1.15cdphp-7.1.152.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-套接字\--enable-sysvmsg\--enable-sysvsem\--enable-sysvshm\--enable-wddx\--with-libxml-dir\--with-xsl\--enable-zip\--enable-mysqlnd-compression-support\--with-pear\--enable-opcachesudomake&&makeinstall这里需要一点时间2.4.配置php-fpmsudocpphp.ini-production/etc/php.inisudocp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.confsudocp/usr/local/php/etc/php-fpm.d/www.conf.default/usr/local/php/etc/php-fpm.d/www.confsudocpsapi/fpm/init.d.php-fpm/etc/init.d/php-fpmsudochmod+x/etc/init.d/php-fpm2.5.startphp-fpm···/etc/init.d/php-fpmstart3.安装Nginx3.1下载Nginxwgethttp://nginx.org/download/nginx-1.13.9.tar.gz3.2安装Nginxtar-zxvfnginx-1.13.9.tar.gzcdnginx-1.13.9./configure--prefix=/usr/local/nginx3.2启动Nginxsudo/usr/local/nginx/sbin/nginxsudo/usr/local/nginx/sbin/nginx-sreloadsudo/usr/local/nginx/sbin/nginx-s停止4。安装FreeTDS4.1下载FreeTDSwgetftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz4.2安装FreeTDS需要注意的就在这里--with-tdsver=7.1,这个很重要tar-zxvffreetds-0.91.tar.gzcdfreetds-0.91./configure--prefix=/usr/local/freetds--with-tdsver=7.1--enable-msdblibmake&&makeinstall4.3验证FreeTDS/usr/local/freetds/bin/tsql-C/usr/local/freetds/bin/tsql-H数据库服务器IP-p1433-U用户名-P密码4.4添加PHP扩展pdo_dblibcd../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&&makeinstall4.5在php.ini中添加pdo_dblib.soextension="pdo_dblib.so"
