Workaround for PHP run with call to undefined function curl_init ()

Source: Internet
Author: User
On the Internet to download a simulated Landing discuz forum PHP Program example, the trial run with the "call to undefined function Curl_init" error, there is no defined function, that is, PHP has not opened the support for the Curl_init function. Google has finally solved, the method is as follows:

System environment, WIN2003 iis6,php version 5.2.12
After loading PHP, do something like $ch = Curl_init (), such a statement, there is a call to undefined function curl_init () error.

Here's how to fix it:

1, found in the php.ini Extension=php_curl.dll, remove the front, php.ini generally under the C:\Windows.

2, find Extension_dir = "ext" in php.ini, remove the front;, change to Extension_dir = "C:\php5\ext".
"C:\php5\ext" is just an example of the path that the extension points to

3, Php_curl.dll, Libeay32.dll, Ssleay32.dll, Php5ts.dll are copied to system32 under.

4, and then restart the computer, fault resolution.

Note: in 5.2.8 version of PHP do not know what the reason, with this method can not be resolved, replaced by 5.2.12 to solve the problem.


Take the Php+apache under Windows as an example.

First, open the php.ini, find the "Extension=php_curl.dll", and then remove the previous ";" Note, restart Apache.

If this problem also occurs, first check the php.ini extension_dir value is which directory, in that directory check whether there is Php_curl.dll, no, please download php_ Curl.dll, and then copy the PHP directory Libeay32.dll and Ssleay32.dll to c:\windows\system32 inside, restart apache,ok!

Run PHP under Ubuntu, always prompt for call to undefined function curl_init (), for no reason: Php5-curl

Curl-related content 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 are borrowed from C, Java and Perl with a couple of the unique php-specific features in. The goal of the language is to allow web developers to write dinamically generated pages quickly. This version of PHP5 is built with the Suhosin patch.

H1>

(PHP 4 >= 4.0.2)

Curl_init--Initialize a curl session

Describe

int curl_init ([string URL])

The Curl_init () function Initializes a new session, returning a curl handle for curl_setopt (), curl_exec (), and the Curl_close () function. If an optional parameter is provided, then the CURLOPT_URL option is set to the value of this parameter. You can use the curl_setopt () function to set it manually.
Example 1. Initializes a new Curl session and retrieves a Web page

<?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 also: 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.