2017年-06月的文章
http 扩展已经加载,但 http 函数全部不可以用
pecl_http 已经安装好,并且成功加载,在 phpinfo() 中可以看到,但 http 函数全部不可用,提示未定义:
Fatal error: Uncaught Error: Call to undefined function http_get()
Fatal error: Uncaught Error: Call to undefined function http_parse_headers()
Fatal error: Uncaught Error: Call to undefined function http_parse_cookie()
这里首先要确认安装的 pecl_http 是什么版本,因为版本1及以下和版本2及以上是完全不同的两个api。
https://pecl.php.net/package/pecl_http
如果安装的是版本1,最新 1.7.6 那么如下函数是可用的
http://php.net/manual/fa/ref.http.php
但如果安装的是2以上版本,最新 3.1.0 ,那么以上的 ht...
pecl_http configure: error: please install and enable pecl/raphf
本文是在 PHP 7.1 下用 pecl 安装 HTTP 3.1,关于 HTTP 都有哪些具体功能请参考:
https://mdref.m6w6.name/http
我这里主要是想用其中解析cookie的一些函数。
[root@lnmp lnmp.cn]# pecl install pecl_http
中途有几个提示输入库路径的,默认留空回车就是。
然而安装并不成功,具体错误如下:
checking whether ext/raphf is enabled... no
configure: error: please install and enable pecl/raphf
ERROR: `/tmp/pear/temp/pecl_http/configure --with-php-config=/usr/local/php7/bin/php-config --with-http-zlib-dir=/usr --with-http-libcurl-dir=/usr --with-http-libevent-dir=/usr --with-...