Skip to content

Uncaught Error: Call to undefined function SendGrid\curl_init() #811

Description

@imgnx

Issue Summary

A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples.


I have the basic example set up in a local development environment (not encrypted) and also a remote testing environment (encrypted). At first, when I was working in my local development environment, a call to $sendgrid->send($email); would return an {} empty object, so thinking that it could be the insecure connection, I moved the code over to a remote testing environment that is running a secure connection (HTTPS). At first, in the remote testing environment, I was getting a 500 Internal Server error so I followed these instructions to output the error. Here's what the error said:

Fatal error: Uncaught Error: Call to undefined function SendGrid\curl_init() in /<path>/<to>/sendgrid-php/vendor/sendgrid/php-http-client/lib/Client.php:459 Stack trace: #0 /<path>/<to>/sendgrid-php/vendor/sendgrid/php-http-client/lib/Client.php(591): SendGrid\Client->makeRequest('post', 'https://api.sen...', Object(SendGrid\Mail\Mail), NULL, false) #1 /<path>/<to>/sendgrid-php/lib/SendGrid.php(75): SendGrid\Client->__call('post', Array) #2 /<path>/<to>/test.php(24): SendGrid->send(Object(SendGrid\Mail\Mail)) #3 {main} thrown in /<path>/<to>/sendgrid-php/vendor/sendgrid/php-http-client/lib/Client.php on line 459

I tried enabling curl within php.ini like in Issue #8 but to no avail.

Steps to Reproduce


  1. Download the SendGrid PHP API as a .zip file and extract all. scp it over to a secure server.
  2. Set up the Hello World example with the SendGrid PHP API over a secure connection.
  3. Run the script by making a simple GET request to the page.

Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?

I wouldn't call it a bug; I'm probably just implementing the code wrong. It could be the fact that I'm not using Composer. I would expect curl_init() to at least return some kind of error if it isn't working. I understand that's a lot to ask but I've been working on this for a little over 24 hours now.

Technical details:

  • sendgrid-php Version: master (latest commit: [commit number])
  • PHP Version: 7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions