欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php運(yùn)行出現(xiàn)Call to undefined function curl_init()的解決方法

 更新時(shí)間:2010年11月02日 22:25:04   投稿:mdxy-dxy  
curl_init -- 初始化一個(gè)CURL會(huì)話,如果提示Call to undefined function curl_init那么需要如下操作即可。

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

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

解決方法如下:

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

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

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

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

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

以windows下的php+apache為例。

  首先,打開(kāi)php.ini,找到“extension=php_curl.dll”,然后去掉前面的“;”注釋?zhuān)貑pache即可。

  如果還出現(xiàn)此類(lèi)問(wèn)題,先檢查php.ini的extension_dir值是哪個(gè)目錄,在那個(gè)目錄下檢查有無(wú)php_curl.dll,沒(méi)有的話請(qǐng)下載php_curl.dll,再把php目錄中的libeay32.dll和ssleay32.dll拷到c:\windows\system32里面,重啟apache,OK!

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

與curl相關(guān)的內(nèi)容見(jiàn):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 -- 初始化一個(gè)CURL會(huì)話

描述  

int curl_init ([string url])  

curl_init()函數(shù)將初始化一個(gè)新的會(huì)話,返回一個(gè)CURL句柄供curl_setopt(), curl_exec(),和 curl_close() 函數(shù)使用。如果可選參數(shù)被提供,那么CURLOPT_URL選項(xiàng)將被設(shè)置成這個(gè)參數(shù)的值。你可以使用curl_setopt()函數(shù)人工設(shè)置。
例 1. 初始化一個(gè)新的CURL會(huì)話,且取回一個(gè)網(wǎng)頁(yè)

<?php
$ch = curl_init();

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

curl_exec ($ch);

curl_close ($ch);
?>


參見(jiàn):curl_close(), curl_setopt()

相關(guān)文章

最新評(píng)論