php運行出現Call to undefined function curl_init()的解決方案_PHP教程

來源:互聯網
上載者:User
在網上下載了一個類比登陸discuz論壇的php程式範例,試運行時出現“Call to undefined function curl_init”這個錯誤提示,沒有定義的函數,也就是php還沒開啟對curl_init函數的支援。Google了一番終於解決了,方法如下:

  以windows下的php+apache為例。

  首先,開啟php.ini,找到“extension=php_curl.dll”,然後去掉前面的“;”注釋,重啟apache即可。

  如果還出現此類問題,先檢查php.ini的extension_dir值是哪個目錄,在那個目錄下檢查有無php_curl.dll,沒有的話請下載php_curl.dll,再把php目錄中的libeay32.dll和ssleay32.dll拷到c:\windows\system32裡面,重啟apache,OK!

在Ubuntu 下運行php,總是提示Call to undefined function curl_init(),原因沒有安轉:php5-curl

與curl相關的內容見:http://packages.ubuntu.com/zh-cn/intrepid/php5-curl

CURL is a library for getting files from FTP, GOPHER, HTTP server.

PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dinamically generated pages quickly. This version of PHP5 was built with the Suhosin patch.

H1>

(PHP 4 >= 4.0.2)

curl_init -- 初始化一個CURL會話

描述  

int curl_init ([string url])  

curl_init()函數將初始化一個新的會話,返回一個CURL控制代碼供curl_setopt(), curl_exec(),和 curl_close() 函數使用。如果選擇性參數被提供,那麼CURLOPT_URL選項將被設定成這個參數的值。你可以使用curl_setopt()函數人工設定。
例 1. 初始化一個新的CURL會話,且取回一個網頁

$ch = curl_init();

curl_setopt ($ch, CURLOPT_URL, "http://www.zend.com/");
curl_setopt ($ch, CURLOPT_HEADER, 0);

curl_exec ($ch);

curl_close ($ch);
?>


參見:curl_close(), curl_setopt()

http://www.bkjia.com/PHPjc/322666.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/322666.htmlTechArticle在網上下載了一個類比登陸discuz論壇的php程式範例,試運行時出現“Call to undefined function curl_init”這個錯誤提示,沒有定義的函數,也就是...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.