Install curl Module under Nginx+FastCGI (Nginx+FastCGI环境安装curl插件)

Situation: I had an issue today when I was trying to upgrade the “WordPress Mobile Pack” plugin from WordPress. The wp-admin page remained blank so I was wondering something went wrong. I tried to delete the WMP plug-in and re-install it, but it was still the same problem.

Action: After I read the error_logs under my website folder, I grabbed the information as follows:

2014/06/05 16:00:26 [error] 13539#0: *1 FastCGI sent in stderr: “PHP Fatal error:  Call to undefined function curl_init() in /****/wp-content/plugins/wordpress-mobile-pack/core/class-admin.php on line 41″ while reading response header from upstream, client:, server:, request: “GET /wp-admin/ HTTP/1.1”, upstream: “fastcgi://”, host: “”

I made a note on official website to let them know:

There were multiple error_logs but they just got repetitively. It said that curl_init() is undefined. Now everything came to a turning point.

Result: I did some research and I realised that CURL is a function of PHP so I need to get it installed.

sudo apt-get install php5-curl

However, I tried to restart the php5-fpm  and Nginx service in Debian but nothing happened (I got a PHP probe installed to check whether the module installed correctly). I tried to reboot the machine and everything was working again!


Hint: Do NOT try to edit the php.ini (put ““) after you get curl module installed. The module package will automatically put a file called “20-curl.ini” under /etc/php5/cgi/conf.d so the curl module will start with the program.

The probe program is found to be very useful during troubleshooting, however you can use phpinfo instead.