1. 云栖社区>
  2. PHP教程>
  3. 正文

linux 下安装php 常用编译选项 配置fpm

作者:用户 来源:互联网 时间:2017-12-01 15:15:51

编译配置常用

linux 下安装php 常用编译选项 配置fpm - 摘要: 本文讲的是linux 下安装php 常用编译选项 配置fpm, linux 下安装php 常用编译选项 配置fpm,有需要的朋友可以参考下。 安装PHP 以下是常用的编译选项 ./configure --prefix=/usr/local/php --with-config-file-path=/

linux 下安装php 常用编译选项 配置fpm,有需要的朋友可以参考下。


  1. 安装PHP

    以下是常用的编译选项

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc/ /--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd  --with-zlib --with-mcrypt --with-pdo-mysql=/usr/local/mysql  --enable-soap --enable-sockets --enable-zip --with-xmlrpc --enable-fpm --enable-mbstring --with-zlib-dir --with-bz2 --with-curl  --with-iconv --enable-xml  --enable-inline-optimization --with-openssl --enable-pcntl --with-gettext --enable-session

如果不幸出现make问题,如下

make时提示:(我也是参考别人的,嘿嘿).....................................................ext/iconv/.libs/iconv.o(.text+0x1738): In function `zif_iconv_mime_encode':/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1017: undefined reference to `libiconv_open'ext/iconv/.libs/iconv.o(.text+0x1756):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1031: undefined reference to `libiconv_open'ext/iconv/.libs/iconv.o(.text+0x1993):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1290: undefined reference to `libiconv_close'ext/iconv/.libs/iconv.o(.text+0x19ad):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1293: undefined reference to `libiconv_close'ext/iconv/.libs/iconv.o(.text+0x1b01):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1102: undefined reference to `libiconv'ext/iconv/.libs/iconv.o(.text+0x1b33):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1134: undefined reference to `libiconv'ext/iconv/.libs/iconv.o(.text+0x1b5e):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1150: undefined reference to `libiconv'ext/iconv/.libs/iconv.o(.text+0x1e10):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1202: undefined reference to `libiconv'ext/iconv/.libs/iconv.o(.text+0x1e3c):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1233: undefined reference to `libiconv'ext/iconv/.libs/iconv.o(.text+0x207f):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1277: more undefined references to `libiconv' followext/iconv/.libs/iconv.o(.text+0x2c08): In function `php_iconv_stream_filter_dtor':/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2393: undefined reference to `libiconv_close'ext/iconv/.libs/iconv.o(.text+0x2cf2): In function `php_iconv_stream_filter_append_bucket':/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2543: undefined reference to `libiconv'ext/iconv/.libs/iconv.o(.text+0x2d34):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2543: undefined reference to `libiconv'ext/iconv/.libs/iconv.o(.text+0x2de7):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2465: undefined reference to `libiconv'ext/iconv/.libs/iconv.o(.text+0x30e2): In function `php_iconv_stream_filter_factory_create':/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2419: undefined reference to `libiconv_open'collect2: ld returned 1 exit statusmake: *** [sapi/cli/php] Error 1解决方法:#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 --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv=/usr/local/libiconv#make#make install另一种解决方法为去除iconv模块也能正常编译php,如下:編輯 Makefile 大約 77 行左右的地方:EXTRA_LIBS = ..... -lcrypt在最後加上 -liconv,例如:EXTRA_LIBS = ..... -lcrypt -liconv再运行make就可以了。最后一种方法:由tonyty163提供:#make ZEND_EXTRA_LIBS='-liconv'#make install

安装完之后

cp /usr/local/php/bin/php /usr/bin

这样就可以直接使用php这个命令了(建立软连接也可以)
查看安装的扩展

php -m

设置php.ini

cp 源码所在位置/php.ini-developer /usr/local/php/etc/php.ini

接下来就是配置fpm了

mv /usr/local/php/etc/php-fpm.conf.default php-fpm.confvim php-fpm.conflisten=/var/run/php-fpm/php-fpm.sockps:这里如果不存在php-fpm文件夹,请自行建立listen.user=nobodylisten.group=nobodychmod -R 755 /var/run/php-fpm上面很关键哦,不然nginx访问fpm的时候,会提示没权限ok现在开始启动fpm/usr/local/php/sbin/php-fpm

以上是最基本的配置,其他选项根据项目需求进行配置

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索编译 , 配置 常用 ,以便于您获取更多的相关知识。