Ashish Kasma
Ashish Kasma

Reputation: 3642

how to remove Fatal error: Call to undefined function curl_init()

I am having following error on using curlas extension

Fatal error: Call to undefined function curl_init() in C:\wamp\www***\index.php on line 15


I have following configuration

;extension=php_bz2.dll 
extension=php_curl.dll 
;extension=php_dba.dll

i installed wampserver2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-x64.exe

i tried to enable other extension also and restarted server but they local host is not able to load that extension.

Upvotes: 1

Views: 18921

Answers (4)

Nemanja Vujacic
Nemanja Vujacic

Reputation: 935

There is solution with all necessary details:

http://www.youtube.com/watch?v=7qNTi1sEfE8

It is in French, but you can understand everything! I solved same problem, even don't speak French. :-)

Many answers forget to mention that you need to add new version of php_curl.dll file from this location: http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/

I added new version of php_curl.dll from archive php_curl-5.4.3-VC9-x64.zip to folders: C:\wamp\bin\php\php5.4.3\ext and C:\Windows\System32 and everything was fine!

Upvotes: 0

Karl Glennon
Karl Glennon

Reputation: 3210

Uncomment this line in the php.ini

extension=php_curl.dll 

And remember to set the extensions directory in your php.ini

extension_dir = “/usr/local/php5/ext”

Upvotes: 0

Shadow
Shadow

Reputation: 9427

2 solutions:

  1. Enable the plugin

    • in wamp this is done in the right click menu.
    • On Linux - it'll probably be in php.ini (though don't forget to restart Apache!)
  2. Check curl exists before attempting to use it:

    • if(!function_exists('curl_init')) echo "cURL not installed. Trying something else...";

Upvotes: 0

newfurniturey
newfurniturey

Reputation: 38416

If you're experiencing this issue when you execute PHP command-line with wamp server, it's because PHP does not hold a reference to the wamp-modified php.ini file (only the apache instance does). Without it, things like curl will not work properly.

To fix this, you need to copy the php.ini file from the Apache folder to the PHP folder.

  • Apache Path: [wamp install dir]\bin\apache\apache2.2.22\bin\php.ini
  • PHP Path: [wamp install dir]\bin\php\php5.4.3\php.ini

You can update the apache/php versions in the folder-paths if yours don't match.

Upvotes: 2

Related Questions