Solution to Call to undefined function curl_init () in php running

Source: Internet
Author: User

I downloaded a php program example simulating login to the discuz forum on the Internet. During the trial run, the error "Call to undefined function curl_init" is prompted, and no function is defined, that is, php does not support the curl_init function. Google finally solved the problem as follows:

Take php + apache in windows as an example.

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

If such problems still occur, first check php. which directory is the extension_dir value of ini? Check for php_curl.dll in that directory. If not, download php_curl.dll and copy libeay32.dll and ssleay32.dll in the php Directory to c: \ windows \ system32, restart apache. OK!

Running php In Ubuntu always prompts Call to undefined function curl_init () for no reason: php5-curl

For content related to curl, 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 initializes a new session and returns 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 is set to the value of this parameter. You can use the curl_setopt () function for manual settings.
Example 1. initialize a new CURL session and retrieve a webpage

<? 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 );
?>


See: curl_close (), curl_setopt ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.