使用未定义的常量

时间:2012-09-05 13:38:03

标签: php

运行从Internet下载的源代码时出现此错误。怎么解决?这似乎是PHP版本的问题。我使用PHP 5.3。

[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 209
[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 210
[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 211
[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant CURLOPT_FAILONERROR - assumed 'CURLOPT_FAILONERROR' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 212
[Wed Sep 05 20:31:40 2012] [error] [client 127.0.0.1] PHP Fatal error:  Call to undefined function curl_init() in /home/hieugioi/Workspace/PHP/Couponic/framework/uniprogy/extensions/curl/CURL.php on line 22
[Wed Sep 05 20:33:15 2012] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 209
[Wed Sep 05 20:33:15 2012] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 210
[Wed Sep 05 20:33:15 2012] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 211
[Wed Sep 05 20:33:15 2012] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant CURLOPT_FAILONERROR - assumed 'CURLOPT_FAILONERROR' in /home/hieugioi/Workspace/PHP/Couponic/protected/modules/location/worklets/WLocationHelper.php on line 212
[Wed Sep 05 20:33:15 2012] [error] [client 127.0.0.1] PHP Fatal error:  Call to undefined function curl_init() in /home/hieugioi/Workspace/PHP/Couponic/framework/uniprogy/extensions/curl/CURL.php on line 22

3 个答案:

答案 0 :(得分:26)

安装curl,你的所有问题都会消失:)

答案 1 :(得分:21)

安装php5-curl。对于Debian,请使用

$ apt-get install php5-curl

答案 2 :(得分:2)

首先用这个命令检查你的php版本

php -v

例如返回 PHP 7.3.27-9 然后为这个版本安装 curl 模块

sudo apt-get install php7.3-curl