SendGrid “Fatal error: Call to undefined function curl_init()” on DigitalOcean VPS

Posted on September 6, 2014 in Web Dev

This is another “dur” moment, but it’s worth jotting down for anyone else to find after they have the issue. Though, I’m not sure anyone else would have missed such an obvious problem!

So as soon as I installed SendGrid on to my Digital Ocean VPS, all the backend stopped working. I changed over to WP_DEBUG=TRUE and found that I was having the following error:

Fatal error: Call to undefined function curl_init() in /var/www/alexmartin/wp-content/plugins/sendgrid-email-delivery-simplified/lib/class-sendgrid-tools.php on line 17

I’m so used to having curl already installed on my machine and existing VPS’s that I had forgotten to install it on this new one I’d just spun up. SendGrid needs to use Curl in order to make the API calls and thus function properly.

Luckily, fixing this is easy. You just need to instal the curl PHP extension. On your server:

apt-get install php5-curl
service nginx restart

Don’t forget to change “nginx” to “apache2” if you’re using Apache 🙂

Hope this helps!

Leave a comment

Was this helpful? Did I miss something? Do you have a question? Get in touch, or tell me below.