Call to undefined function: curl_init() -- when run in shell

Discussion in 'PHP' started by andre75, Feb 10, 2007.

  1. #1
    I have developed a bunch of php scripts and I would like to execute them in a shell without having to go through apache.
    I can execute most scripts with:
    >php script.php
    and it works quite well, however scripts that use curl don't work, even though I have curl installed and php4-curl as well (i am using a debian system).
    phpinfo will show curl enabled when I run it from a browser through apache but it wont show curl when I run it from a shell.

    I would highly appreciate some tips.

    Andre
     
    andre75, Feb 10, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    What about when you run same scripts in a browser environment ?

    When I exec php from the cli in windows the curl dll always fails to load and halts execution, I never bothered fixing it becuase it doesn't affect production.
     
    krakjoe, Feb 11, 2007 IP
  3. andre75

    andre75 Peon

    Messages:
    1,203
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply. It works in the browser environment.
    However I found that the php.ini in :
    /etc/php4/cli/php.ini
    was different from:
    /etc/php4/apache2/php.ini
    (both were automatically generated by apt-get the debian installer).
    Everything is working now.
    Its probably the same in windows? Just run phphinfo and check what php.ini is used.
     
    andre75, Feb 11, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    I looked further, it's the way that curl is/was compiled (for windows), I can use the source to build libcurl and compile either a dll that works in cli with no errors, or in cgi/apache with no errors, but not both at the same time.

    On a unix system all the header files are lying around still for both types, giving the php libraries access to every single prototype function that curl has ( on compile ), on windows its different, everything is statically linked which is the reason for one or the other.

    Glad you got it fixed up though.......
     
    krakjoe, Feb 11, 2007 IP