linux centos 编译php7.2扩展 judy 错误 error RETURN_STRINGL requires *** 解决方案

解决方案:

1.确定当前扩展 支持php7

2.按照正常方式编译 报错 基本可能是 centos 自带的老版本php(我的是这个原因)影响.php扩展编译的时候读取到了老版本php的文件

3.解决 按照  百度搜索"Linux CentOS完全卸载PHP" https://www.cnblogs.com/sunshine-H/p/8117105.html 卸载php老版本 后解决

=========后面为正常编译可以不看==========

php7.2 linux 编译 以及常见错误

1.下载源码 解压(源码目录需要有可写权限 需要设置) 进入源码目录
2. 安装 依赖包
yum install epel-release -y
yum update
yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
3.配置 php编译参数  (注意 --prefix=  php默认目录) --enable-maintainer-zts  --enable-zts(windows) 表示  启用线程安装版本
php.ini 默认放到 php 二进制文件目录(下面配置 在 /opt/php72/bin/ ) 源码中没有php.ini 自己从其他地方拷贝一个 修改一些 放进去
--disable-debug  表示调试 应该是调试扩展用的一般不需要加上
./configure --prefix=/opt/php72 --exec-prefix=/opt/php72/ --bindir=/opt/php72/bin/ --sbindir=/opt/php72/sbin/ --includedir=/opt/php72/include/ --libdir=/opt/php72/lib/php/ --mandir=/opt/php72/php/man/ --with-config-file-path=/opt/php72/etc/  --with-mhash --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --with-pear --with-gettext --enable-session --with-curl --with-openssl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm  --enable-fileinfo 

4.开始编译(如果切换 nts ts 版本 需要运行 " make clean" 清理 然后重新运行 configure  )

make  && make install
5.编译扩展

下载扩展源码 解压到php源码 ext目录 , 
进入扩展源码目录

6.运行phpize(多个版本php 需要使用全路径 运行对应版本的phpize)

/opt/php72/bin/phpize

7.运行./configure  注意可能因为路径问题报错 最好加上 --with-php-config

./configure --with-php-config=/opt/php72/bin/php-config

8.编译(如果切换 nts ts 版本 需要运行 " make clean" 清理 然后重新运行 configure  )

make  && make install
我遇到的错误
1.如果phpinfo() 发现 php.ini未加载  
尝试  http://www.jb51.net/article/103087.htm   strace /usr/local/php7/sbin/php-fpm -i 2>1.log  查询php.ini文件路径(新版php默认首先读写 php 二进制文件所在目录 )
2.出现 编译错误 考虑电脑是不是有多个版本的php php加载到了其他版本的 php文件 




猜你喜欢

转载自blog.csdn.net/tangshangkui/article/details/80494198
今日推荐