PHP源码编译
成都创新互联网站建设公司是一家服务多年做网站建设策划设计制作的公司,为广大用户提供了成都网站建设、做网站,成都网站设计,广告投放平台,成都做网站选成都创新互联,贴合企业需求,高性价比,满足客户不同层次的需求一站式服务欢迎致电。
下载软件包
从www.php.net官方网站下载PHP源码包
##########################
soap动态
fpm 平滑加载php配置(php,)
zend加速php
##########################
[root@server79 ~]# tar jxf php-5.4.12.tar.bz2
新建nginx用户
[root@server79 php-5.4.12]#useradd -M -d /usr/local/lnmp/nginx/ -s /sbin/nologin nginx
配置安装环境
安装PHP需要下面软件包的支持,如果没有安装,请自行安装。
yum install net-snmp-devel curl-devel libxml2-devel libpng-devel libjpeg-devel freetype-
devel gmp-devel openldap-devel -y
开始编译安装PHP:
--enable-fpm:激活对FastCGI模式的fpm支持
[root@server79 php-5.4.12]# ./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-pear --with-gettext --with-gmp --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-mbstring --with-MySQLi=/usr/local/lnmp/mysql/bin/mysql_config --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt=/usr/local/lnmp/modules/libmcrypt/ --with-mhash=/usr/local/lnmp/modules/mhash/
错误1:
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
根据提示解决:
[root@server79 php-5.4.12]# yum install libxml2-devel -y
再次编译,出现错误2:
configure: error: Please reinstall the libcurl distribution -
easy.h should be in
解决:
[root@server79 php-5.4.12]# yum install curl-devel
错误3:
configure: error: jpeglib.h not found
解决 :安装图形支持
yum install libpng-devel libjpeg-devel freetype-devel gmp-devel
错误4:
configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
解决:
[root@server79 php-5.4.12]# yum install net-snmp-devel
[root@server79 php-5.4.12]# make ZEND_EXTRA_LIBS='-liconv'
make完之后会报错
错误:
/usr/bin/ld: cannot find -liconv
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
解决:
[root@server79 php-5.4.12]# vim /etc/ld.so.conf
/usr/local/lnmp/modules/libiconv/lib
加载
[root@server79 php-5.4.12]#ldconfig /usr/local/lnmp/modules/libiconv/lib
[root@server79 php-5.4.12]# make
[root@server79 php-5.4.12]# make install