centos 下 自己编译php-fpm


系统自带的安装命令yum install php-fpm 版本是5.3
找了一圈,可以升级到5.4

不过开发用了5.6 最后还得自己编译,想用新的只能自己动手编译php-fpm了。

http://php.net/downloads.php

福利:如何安装mysql

yum install mysql mysql-devel mysql-server

下载php5.6.27
tar zxvf php5.6.27.tar.gz

yum -y install gcc gcc-c++ libxml2 libxml2-devel

yum install libmcrypt libmcrypt-devel mcrypt

12月23发现新服务器缺少各种东西,来一句话搞定

yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

cd php5.6.27

./configure –enable-fpm –enable-mbstring –with-mysql=/usr/local/mysql

–enable-mbstring表示启用mbstring模块mbstring模块的主要作用在于检测和转换编码,提供对应的多字节操作的字符串函数。目前php内部的编码只支持ISO-8859-*、EUC-JP、UTF-8,其他的编码的语言是没办法在php程序上正确显示的,所以我们要启用mbstring模块。

同时我们也只是简单的开启和扩展php的一部分功能,其他需要的功能,请自行添加。

用一下我之前的配置
./configure –prefix=/data1/server/php-cgi –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –enable-mbstring –with-mysql –with-mysqli –with-pdo-mysql –enable-sockets –with-curl –with-libxml-dir –with-config-file-path=/data1/server/php-cgi/etc –with-zlib –enable-exif –enable-ftp –with-xmlrpc –enable-zip –with-iconv-dir –with-libxml-dir –with-mcrypt –with-tidy –with-tidy –enable-fpm

试试直接带上ssh2,去掉tidy
./configure –prefix=/data1/server/php-cgi –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –enable-mbstring –with-mysql –with-mysqli –with-pdo-mysql –enable-sockets –with-curl –with-libxml-dir –with-config-file-path=/data1/server/php-cgi/etc –with-zlib –enable-exif –enable-ftp –with-xmlrpc –enable-zip –with-iconv-dir –with-libxml-dir –with-mcrypt –with-ssh2 –enable-fpm

发现提示一个warning 不认识的ssh2 说明不能直接安装上去。去掉吧

./configure –prefix=/data1/server/php-cgi –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –enable-mbstring –with-mysql –with-mysqli –with-pdo-mysql –enable-sockets –with-curl –with-libxml-dir –with-config-file-path=/data1/server/php-cgi/etc –with-zlib –enable-exif –enable-ftp –with-xmlrpc –enable-zip –with-iconv-dir –with-libxml-dir –with-mcrypt –enable-fpm

./configure --prefix=/data1/server/php-cgi --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-mbstring --with-mysql --with-mysqli --with-pdo-mysql --enable-sockets --with-curl --with-libxml-dir --with-config-file-path=/data1/server/php-cgi/etc --with-zlib --enable-exif --enable-ftp --with-xmlrpc --enable-zip  --with-libxml-dir --with-mcrypt --enable-fpm

make一下
死活报错undefined reference to `libiconv’
解决方法:
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
#tar -zxvf libiconv-1.13.1.tar.gz
#cd libiconv-1.13.1
# ./configure –prefix=/usr/local/libiconv
# make
# make install

再检查php,指定 iconv的位置 –with-iconv=/usr/local/libiconv 注意这个目录一定要指

./configure –prefix=/data1/server/php-cgi –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –enable-mbstring –with-mysql –with-mysqli –with-pdo-mysql –enable-sockets –with-curl –with-libxml-dir –with-config-file-path=/data1/server/php-cgi/etc –with-zlib –enable-exif –enable-ftp –with-xmlrpc –enable-zip –with-libxml-dir –with-mcrypt –with-iconv=/usr/local/libiconv –enable-fpm

回来

make
make test
make install

成功啦

接下来怎么玩,看我之前的一个文章 http://java-er.com/blog/nginx-php-fpm/

如果你是一名技术人员可加我QQ 2651-0442-02,如果你是java技术人还可以加入QQ群 1784-9136-0
你将得到的不仅仅是技术的交流,还有职业机会,人生解惑.
首发地址:月小升博客https://java-er.com/blog/centos-install-self-php-fpm/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
此条目发表在 Linux 分类目录,贴了 , 标签。将固定链接加入收藏夹。
既然来了,就评论一下,不会怀孕的

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">