国产欧美日韩第一页|日本一二三不卡视频|在线精品小视频,亚洲第一免费播放区,metcn人体亚洲一区,亚洲精品午夜视频

幫助中心 >  技術(shù)知識庫 >  云服務(wù)器 >  服務(wù)器教程 >  php運(yùn)行出現(xiàn)Call to undefined function curl_init()

php運(yùn)行出現(xiàn)Call to undefined function curl_init()

2016-07-01 07:04:41 12567

curl_init -- 初始化一個CURL會話,如果提示Call to undefined function curl_init那么需要如下操作即可。

在網(wǎng)上下載了一個模擬登陸discuz論壇的php程序范例,試運(yùn)行時出現(xiàn)“Call to undefined function curl_init”這個錯誤提示,沒有定義的函數(shù),也就是php還沒打開對curl_init函數(shù)的支持。Google了一番終于解決了,方法如下:

系統(tǒng)環(huán)境,WIN2003 IIS6,PHP版本5.2.12
在裝好PHP后,執(zhí)?類似$ch = curl_init();這樣的語句,出現(xiàn)Call to undefined function curl_init()的錯誤提示。

解決方法如下:

1、在php.ini中找到extension=php_curl.dll,去掉前面的,php.ini一般在c:windows下面。

2、在php.ini中找到extension_dir = "ext",去掉前面的;,改為extension_dir = "C:php5ext"?
"C:php5ext"只是示例,即擴(kuò)展指向的路徑要對

3、php_curl.dll、libeay32.dll、ssleay32.dll、php5ts.dll都拷到system32下面去。

4、然后重啟電腦,故障解決。

注意:在PHP的5.2.8版本中不知道什么原因,用這方法無法解決,換成了5.2.12才解決掉。


以windows下的php+apache為例。 

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

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

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

與curl相關(guān)的內(nèi)容見:http://www.tjdsmy.cn/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()函數(shù)將初始化一個新的會話,返回一個CURL句柄供curl_setopt(), curl_exec(),和 curl_close() 函數(shù)使用。如果可選參數(shù)被提供,那么CURLOPT_URL選項(xiàng)將被設(shè)置成這個參數(shù)的值。你可以使用curl_setopt()函數(shù)人工設(shè)置。 
例 1. 初始化一個新的CURL會話,且取回一個網(wǎng)頁 

<?php 
$ch = curl_init(); 

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

curl_exec ($ch); 

curl_close ($ch); 
?> 

參見:curl_close(), curl_setopt()

提交成功!非常感謝您的反饋,我們會繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: