Jpush 致命错误: Call to undefined function JPush\curl_init()
Jpush 致命错误: Call to undefined function JPush\curl_init()
Jpush 致命错误: Call to undefined function JPush\curl_init()
Jpush 致命错误: Call to undefined function JPush\curl_init()
重要问题说三遍 。。。。 Windows 用户请绕道 , 执政对Linux PHP用户
原因 很简单, PHP没有添加 curl 扩展 ,我之前写过一篇日志 关于安装pdo扩展的日志 https://blog.csdn.net/chmod_r_755/article/details/78466590
同样的方法安装 curl 扩展 , 首先我们进入到 PHP源码的
[root@jdu4e00u53f7 ~]# cd /你的PHP路径/php-7.1.11/ext/curl/
[root@jdu4e00u53f7 curl]# ls
config.m4 CREDITS interface.c package.xml share.c
config.w32 curl_file.c multi.c php_curl.h tests
由于我已经安装了 m4 和 autoconf ,如果你没有安装,你需要执行下面命令 。。。 安装请忽略
//// [root@jdu4e00u53f7 curl]# yum install m4
//// [root@jdu4e00u53f7 curl]# yum install autoconf
/// 需要安装 m4 和 autoconf
[root@jdu4e00u53f7 curl]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
注意,这里安装的是 PHP对curl的扩展,也就是必须保证你的Linux上安装过 curl
curl 包下载地址 : https://curl.haxx.se/download/
下载并安装curl , 我这里下载的版本是 curl-7.59.0.tar.gz
[root@iZuf6c10vi9grvyeybhz2mZ curl]# wget https://curl.haxx.se/download/curl-7.59.0.tar.gz
--2018-04-16 10:59:49-- https://curl.haxx.se/download/curl-7.59.0.tar.gz
[root@iZuf6c10vi9grvyeybhz2mZ curl]# tar -zxvf curl-7.59.0.tar.gz
[root@iZuf6c10vi9grvyeybhz2mZ curl]# cd curl-7.59.0
[root@iZuf6c10vi9grvyeybhz2mZ curl-7.59.0]# ./configure --prefix=/usr/local/curl
[root@iZuf6c10vi9grvyeybhz2mZ curl-7.59.0]# make
[root@iZuf6c10vi9grvyeybhz2mZ curl-7.59.0]# make install
我们安装完成了curl , 还需要安装一个 插件 curl-devel ,直接执行命令
[root@iZuf6c10vi9grvyeybhz2mZ curl]# yum -y install curl-devel
接下来安装 PHP curl 扩展
[root@iZuf6c10vi9grvyeybhz2mZ curl]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-curl==/usr/local/curl/
[root@iZuf6c10vi9grvyeybhz2mZ curl]# make
[root@iZuf6c10vi9grvyeybhz2mZ curl]# make install
然后 我们可以看到 。。。。
curl.so 生成完毕, 这个时候我们就要去 修改PHP的 配置文件了 。。。。
[root@iZuf6c10vi9grvyeybhz2mZ curl]# cd /usr/local/php/lib/
[root@iZuf6c10vi9grvyeybhz2mZ lib]# ls
php php.ini
[root@iZuf6c10vi9grvyeybhz2mZ lib]# pwd
/usr/local/php/lib
[root@iZuf6c10vi9grvyeybhz2mZ lib]# ls
php php.ini
然后,重启Apache
[root@iZuf6c10vi9grvyeybhz2mZ lib]# /usr/local/apache2/bin/apachectl stop
[root@iZuf6c10vi9grvyeybhz2mZ lib]# /usr/local/apache2/bin/apachectl start
不管你有没有成功, 反正我是成功了 。。。。。。。