【发布时间】:2020-08-22 07:39:38
【问题描述】:
如果我在代码中使用CURLOPT_TCP_FASTOPEN 选项,则会收到以下错误。
使用未定义的常量 CURLOPT_TCP_FASTOPEN - 假设 'CURLOPT_TCP_FASTOPEN'
CURLOPT_TCP_FASTOPEN 是 php 7.4.5 interface 中支持的选项。
php -v
PHP 7.4.5 (cli) (built: Apr 14 2020 12:54:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.5, Copyright (c), by Zend Technologies
卷曲-V
curl 7.70.0 (x86_64-redhat-linux-gnu) libcurl/7.70.0 NSS/3.44 zlib/1.2.7 libpsl/0.7.0 (+libicu/50.1.2) libssh2/1.9.0 nghttp2/1.31.1
Release-Date: 2020-04-29
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz Metalink NTLM NTLM_WB PSL SPNEGO SSL UnixSockets
我在这里做错了什么?
编辑 1:
这里是与 YouriKoeman 的概述相对应的附加信息
内核版本:3.10.0-1062.12.1.el7.x86_64
操作系统:unix (Centos 7.x)
curl --tcp-fastopen -L http://www.google.com 返回以下错误:
curl: (55) Send failure: Operation not supported for curl --tcp-fastopen -L http://www.google.com
【问题讨论】:
-
抱歉 - 只需检查它是否已启用 - stackoverflow.com/questions/22713591/…
-
@NigelRen curl 扩展已启用。我可以很好地提出 curl 请求,只有这个选项会导致问题
-
能否分享一下这个命令的结果:
php -r 'print_r(curl_version()['version']);' -
我收到了
PHP Warning: Use of undefined constant version - assumed 'version' (this will throw an Error in a future version of PHP) in Command line code on line 1你的命令 -
@0stone0 这里是 curl 的 phpinfo 的一部分-i.gyazo.com/710f2787f38aa4a6438612fdc9b3ac20.png