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 <curl-dir>/include/curl/
解决:
[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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。