Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php curl works from cli but not from apache

Tags:

php

curl

apache2

I can't get cURL to work from inside Apache by any means. It's actually fairly strange too provided that:

  1. I can execute my PHP pages from the CLI and it POSTs my requests perfectly fine
  2. When I look at my error logs, I get "PHP Fatal error: Call to undefined function curl_init()" as if the extension isn't installed at all. Similarly, a quick `phpinfo()` also yields such as if the extension isn't installed.

Additionally, when I built PHP, I opted the "--enable-curl" flag.

like image 648
jerluc Avatar asked Dec 20 '25 21:12

jerluc


1 Answers

You are probably not loading the extension in the appropriate php.ini. The file should include something like:

[PHP_CURL]
extension=php_curl.dll

Also, --enable-curl is not a PHP configure option. --with-curl=[DIR] is the one you'd want. Check out the cURL installation instructions.

php_curl.dll should be inside PHP's ext directory when configured correctly.

like image 123
bschaeffer Avatar answered Dec 22 '25 12:12

bschaeffer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!