"Use of undefined constant CURLOPT_PROTOCOLS and CURLPROTO_HTTP" but it works?
Hi on our dev environment we have show all errors, warnings and notices. I'm getting this:
Notice: Use of undefined constant CURLOPT_PROTOCOLS - assumed 'CURLOPT_PROTOCOLS' in C:\notion\implementation\development\asterix\library\ExternalLibs\panda.php on line 69
Notice: Use of undefined constant CURLPROTO_HTTP - assumed 'CURLPROTO_HTTP' in C:\notion\implementation\development\asterix\library\ExternalLibs\panda.php on line 69
The code on line 69:
curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP);
But the CURL code works, it goes off to the other server and retrieves wha开发者_运维知识库ts necessary. What do these notices mean?
Thanks very much.
This seemed to be a bug in PHP 5.2.9: #48390
According to the documentation, the option "CURLOPT_PROTOCOLS" is available as of cURL 7.19.4, but PHP is throwing a notice: "Use of undefined constant CURLOPT_PROTOCOLS - assumed 'CURLOPT_PROTOCOLS'"
Also all the "CURLPROTO_*" constants are not available:
Use of undefined constant CURLPROTO_HTTPS - assumed 'CURLPROTO_HTTPS'
I don't know what this setting does exactly, but I would assume in your case, the setting is not applied at all, because curl can't interpret the string "CURLPROTO_HTTP". If it works either way, it may be safer to comment it out, because with the next upgrade, the constants are likely to be there.
This issue can occur either curl extension is not enabled or available.
Try to install curl extension from [how to download curl on ubuntu][1]
I faced same issue when I was calling a script with php-cli but the extension was not enabled for cli mode.
精彩评论