编译安装openresty+php7.1,openrestyphp7.1


操作系统:CentOS Linux release 7.3.1611 (Core) 第一部分编译安装php以及扩展 1.php的扩展安装 1.1png安装(gd库) tar zxvf libpng-1.6.26.tar.xz cd libpng-1.6.26 ./configure --prefix=/server/extension/php/libpng make &make install 1.2jpeg安装(gd库) tar zxvf jpegsrc.v9.tar.gz cd jpeg-9/ ./configure --prefix=/server/extension/php/libjpeg make && make install 1.3libiconv(字符编码) tar zxvf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/server/extension/php/libiconv make && make install 1.4mhash tcd cd mhash-0.9.9.9 ./configure --prefix=/server/extension/php/libmhash make && make install 1.5libmcrypt tar zxvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 ./configure --prefix=/server/extension/php/libmcrypt make && make install 1.6openssl安装 tar zxvf openssl-1.0.2f.tar.gz cd openssl-1.0.2f ./config --prefix=/server/extension/php/openssl make && make install 1.8libxml2 tar zxvf libxml2-sources-2.9.2.tar cd libxml2-2.9.2 ./configure --prefix=/server/extension/php/limxml2 make && make install 1.9 curl 安装 tar zxvf curl-7.46.0.tar.gz cd curl-7.46.0 ./configure --prefix=/server/extension/php/curl --with-ssl=/www/server/extension/php/openssl/ make && make install 1.20freetype tar zxvf freetype-2.1.10.tar.bz2 cd freetype-2.1.10 ./configure --prefix=/server/extension/php/freetype 编译php ./configure \ --prefix=/server/php/php/php7.1 \ --with-config-file-path=/server/php/php7.1 \ --enable-pdo \ --with-pdo-mysql \ --with-mysql-sock=/tmp/mysql.sock \ --enable-opcache \ --enable-cgi \ --enable-fpm \ --enable-sockets \ --enable-mbstring \ --enable-mbregex \ --enable-bcmath \ --enable-session \ --enable-xml \ --enable-zip \ --with-zlib \ --with-gd-dir=/server/extension/gd \ --with-png-dir=/server/extension/libpng \ --with-freetype-dir=/server/extension/freetype \ --with-jpeg-dir=/server/extension/libjpeg \ --with-curl=/server/extension/curl \ --with-mhash=/server/extension/libmhash \ --with-mcrypt=/server/extension/libmcrypt \ --with-libxml-dir=/server/extension/libxml2 \ --with-iconv=/server/extension/libiconv \ --with-zlib-dir=/server/extension/zlib \ --with-openssl=/server/extension/openssl \ 注意(有可能遇到): 1.安装libiconv报错 ./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)  _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 先找到stdio.in.h vi $HOME/libiconv-1.14/srclib/stdio.in.h 然后跳到698行,把_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); #if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)替换成 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); #endif(还有一个endif) 2.configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no 报错其实是-with-gd-dir写成了--with-gd 3.新错误(PHP7.1.5) configure: error: Don’t know how to define struct flock on this system,set –enable-opcache=no 这个错误第一次见到,估计是新版本的问题,也没找到具体解释,,解决方法: 编辑 /etc/ld.so.conf 添加一行/usr/local/lib 保存退出,执行:ldconfig 4.高版本curl报错,修改php.ini(查看手册) always_populate_raw_post_data = -1 提供一个php扩展git地址: https://github.com/gophp7/gophp7-ext/wiki/extensions-catalog 5.mongo扩展与memcache扩展 7.1.5php是没有mongo扩展,只有在5.6以上(包含5.6)可以安装 memcache扩展用上面git账号的扩展没有问题,官方包目前未更新 6.5.6的php上安装mongodb扩展不能用v3哦 第二部分编译:openresty cd openresty-1.11.2.3/ ./configure --prefix=/www/server/openresty --with-pcre=/www/pcre-8.38/ --with-openssl=/www/openssl-1.0.2f/ --with-zlib=/server/source/php/zlib-1.2.8 make && make install 注意:如果出现报错类似:You need a C++ compiler for C++ support.,缺少c++编译器 yum install gcc-c++ 以上就基本的环境编译,有很多错误不再一一列出了

相关内容

    暂无相关文章