背景:
阅读新闻
PHP源码安装、简单配置、测试及连接数据库
[日期:2016-10-13] 来源:Linux社区 作者:firelowrie [字体:]
主机环境 RedHat6.5 64位
实验环境 服务端 ip172.25.29.1 php
安装包 php-5.6.20.tar.bz2
re2c-0.13.5-1.el6.x86_64.rpm
libmcrypt-2.5.8-9.el6.x86_64.rpm
libmcrypt-devel-2.5.8-9.el6.x86_64.rpm
Discuz_X3.2_SC_UTF8.zip
1. 安装php
1.解压
[root@server1 mnt# tar jxf php-5.6.20.tar.bz2 #解压
[root@server1 php-5.6.20]# rpm -vih libmcrypt-* #安装libmcrypt库
[root@server1 php-5.6.20]# yum installre2c-0.13.5-1.el6.x86_64.rpm –y #安装re2c
2.软件配置
[root@server1 php-5.6.20]# ./configure --prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/php/etc --with-openssl --with-snmp--with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir--with-jpeg-dir --with-freetype-dir --with-gettext --without-pear --with-gmp--enable-inline-optimization --enable-soap --enable-ftp --enable-sockets--enable-mbstring --with-mysqli --with-mysql --with-pdo-mysql --enable-fpm--with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash
如果出现如下错误
[root@server1 php-5.6.20]# yum install libxml2-devel -y
重新配置
[root@server1 php-5.6.20]# ./configure--prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc--with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir--with-png-dir --with-jpeg-dir --with-freetype-dir --with-gettext--without-pear --with-gmp --enable-inline-optimization --enable-soap--enable-ftp --enable-sockets --enable-mbstring --with-mysqli --with-mysql--with-pdo-mysql --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx--with-mcrypt --with-mhash
如果出现如下错误
[root@server1 php-5.6.20]# yum provides */easy.h
[root@server1 php-5.6.20]# yum install -ylibcurl-devel-7.19.7-37.el6_4.x86_64
重新配置
[root@server1 php-5.6.20]# ./configure--prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc--with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir--with-png-dir --with-jpeg-dir --with-freetype-dir --with-gettext--without-pear --with-gmp --enable-inline-optimization --enable-soap--enable-ftp --enable-sockets --enable-mbstring --with-mysqli --with-mysql--with-pdo-mysql --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx--with-mcrypt --with-mhash
如果出现如下错误
[root@server1 php-5.6.20]# yum provides */jpeglib.h
[root@server1 php-5.6.20]# yum install -ylibjpeg-turbo-devel-1.2.1-1.el6.x86_64
重新配置
[root@server1 php-5.6.20]# ./configure--prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc--with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir--with-png-dir --with-jpeg-dir --with-freetype-dir --with-gettext--without-pear --with-gmp --enable-inline-optimization --enable-soap--enable-ftp --enable-sockets --enable-mbstring --with-mysqli --with-mysql--with-pdo-mysql --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx--with-mcrypt --with-mhash
如果出现如下错误
[root@server1 php-5.6.20]# yum provides */png.h
[root@server1 php-5.6.20]# yum install -ylibpng-devel-1.2.49-1.el6_2.x86_64
重新配置
[root@server1 php-5.6.20]# ./configure--prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc--with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir--with-png-dir --with-jpeg-dir --with-freetype-dir --with-gettext--without-pear --with-gmp --enable-inline-optimization --enable-soap--enable-ftp --enable-sockets --enable-mbstring --with-mysqli --with-mysql--with-pdo-mysql --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx--with-mcrypt --with-mhash
如果出现如下错误