How do I enable curl for php

2019-01-25 16:39发布

问题:

I'm using NGINX with PHP-FPM on Debian Wheezy via DotDeb repo.

This is the only curl reference in my php.ini file and I'm not sure what I need to do. Any help is appreciated (it's already installed)

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =

; Local Variables:
; tab-width: 4
; End:

回答1:

Check whether you have php5-curl installed

dpkg -l | grep 'php5-curl'

If isn't installed,

apt-get install php5-curl

Ensure the path in extension_dir exists, and contains curl.so, if not, change to the correct path.

php -i | grep extension_dir

Ensure the /etc/php5/mods-available/curl.ini exists and has the curl.so loaded

; configuration for php CURL module
; priority=20
extension=curl.so

If everything is correct, restart PHP-FPM

/etc/init.d/php5-fpm restart


回答2:

To enable curl uncomment

;extension=php_curl.dll
to
extension=php_curl.dll