cURL not working on localhost

Discussion in 'PHP' started by AHA7, May 20, 2007.

  1. #1
    Hello,

    I am running PHP 5 (php-5.2.2-Win32 - automatic installation) with Apache2.2.4 on my local PC (win xp).
    I am trying to use the cURL library functions but I get the following error:

    Fatal error: Call to undefined function curl_init() in D:\php_files\file.php on line X

    What could be the problem? How can I enable cURL support on my local PHP version?

    P.S. I can see a file named "php_curl.dll" in the "LocalDrive:\PHP\ext" folder.
     
    AHA7, May 20, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Open:

    php/php.ini
    php/browscap/php.ini
    php/php4/php.ini (if existent)
    apache/bin/php.ini

    And uncomment this line in all of them: extension=php_curl.dll

    Then restart Apache and try again.
     
    nico_swd, May 21, 2007 IP
  3. Free Directory

    Free Directory Peon

    Messages:
    89
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    one of the best things i've saw for windows... it's called WAMP (Windows Apache Mysql and PHP)
    That come with all extensions just have to enable what you need.
    i have it at home and works so fine:)
    read more here: http://www.wampserver.com/en/
     
    Free Directory, May 21, 2007 IP
  4. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Most extensions come bundled with PHP but not enabled.

    Just uncomment the line nico_swd described in your php.ini file. IIRC, when I installed PHP manually, it put a shortcut to the php.ini in the Start menu and the actual file was in the WINDOWS folder.

    You shouldn't need to change more than one ini file, just find the one that's being used and enable the extension in that.
     
    rodney88, May 21, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    I had to change all php.ini files. Maybe because I'm using XAMPP...
     
    nico_swd, May 21, 2007 IP
  6. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #6
    On XAMPP, the only one being used is the apache/bin/php.ini (or at least that's where it is on the lite version).
     
    rodney88, May 21, 2007 IP
  7. Free Directory

    Free Directory Peon

    Messages:
    89
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    php.ini it's in windows folder only for version under 5.0...
    For latest versions the php.ini it's in the php root folder.
    My advice it's to use the wamp, as it's bundled with lot of premade extensions and easy reachable settings. It offer a really handfull way of enabling/disabling php plugins and extensions.
    It's piece of cake to set curl, magic quotes, register globals, fopen, and much more. just ... 3 or 4 clicks away :) I've used it to set a sugarCRM, and i enabled everything needed, in 5 minutes, without using any text editor;)
    Uh... it's not a commercial:) Just an advice from a web developer to another.
     
    Free Directory, May 21, 2007 IP