Solution to Call to undefined function curl_init() when running PHP_PHP Tutorial

WBOY
Release: 2016-07-21 15:33:07
Original
1124 people have browsed it

I downloaded a PHP program example from the Internet that simulates logging into the discuz forum. During the trial run, the error message "Call to undefined function curl_init" appeared. There is no defined function, that is, PHP has not yet turned on support for the curl_init function. After searching on Google, I finally solved it. The method is as follows:

Take php+apache under Windows as an example.

First, open php.ini, find "extension=php_curl.dll", then remove the ";" comment in front and restart apache.

If this kind of problem still occurs, first check which directory the extension_dir value of php.ini is, and check whether there is php_curl.dll in that directory. If not, please download php_curl.dll, and then change the directory in the php directory. Copy libeay32.dll and ssleay32.dll to c:windowssystem32, restart apache, OK!

When running php under Ubuntu, it always prompts Call to undefined function curl_init(). The reason is not fixed: php5-curl

For curl-related content, please see: 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 -- Initialize a CURL session

Description

int curl_init ([string url])

The curl_init() function will initialize a new session and return a CURL handle for use by the curl_setopt(), curl_exec(), and curl_close() functions. If the optional parameter is provided, the CURLOPT_URL option will be set to the value of this parameter. You can set it manually using the curl_setopt() function.
Example 1. Initialize a new CURL session and retrieve a web page

$ch = curl_init();

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

curl_exec ($ch);

curl_close ($ch );
?>


See: curl_close(), curl_setopt()

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322666.htmlTechArticleI downloaded a php program example from the Internet to simulate logging into the discuz forum. During the trial run, "Call to undefined function curl_init" appeared. "This error message indicates that there is no defined function, that is...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template