开发者

php curl works from cli but not from apache

开发者 https://www.devze.com 2023-03-10 20:52 出处:网络
I can\'t get cURL to work from inside Apache by any means. It\'s actually fairly strange too provided that:

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()` al开发者_如何学Cso yields such as if the extension isn't installed.

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


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.


I had same problem after installing php5-curl. I rebooted apache and that fixed it.

sudo /etc/init.d/apache2 restart for ubuntu 12.04


I had similar problem - worked from cli, silently failed from Apache 2.4

I've tried:

1) copying ssleay32.dll and libeay32.dll from php folder into apache\bin folder - didn't work

2) deleting ssleay32.dll and libeay32.dll from apache\bin folder completely - WORKED.

You should restart apache server each time you make change to make it work.

Also you should install both x86 and x64 versions of C++ Resistributable Visual Studio from Microsoft.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号