Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cURL error 60: SSL certificate problem: certificate has expired #12

Closed
alejandrotrevi opened this issue Oct 28, 2022 · 2 comments
Closed

Comments

@alejandrotrevi
Copy link

alejandrotrevi commented Oct 28, 2022

Is anyone else having this issue? this is a brand new laravel project on windows, running through php artisan serve im just running the code from the example in the docs.

My code:

Route::get('/', function () {
    $client = OpenAI::client(config('app.open-ai-key'));

    $prompt = <<<TEXT
Extract the requirements for this job offer as a list.
 
"We are seeking a PHP web developer to join our team. The ideal candidate will have experience with PHP, MySQL, HTML, CSS, and JavaScript. They will be responsible for developing and managing web applications and working with a team of developers to create high-quality and innovative software. The salary for this position is negotiable and will be based on experience."
TEXT;

    $result = $client->completions()->create([
        'model' => 'text-davinci-002',
        'prompt' => $prompt,
    ]);

    ray($result);
});

Flare exception:
https://flareapp.io/share/xPQoaD25#F47

@gehrisandro
Copy link
Collaborator

I can't reproduce the error. At least right now, the certificate seems to be valid: https://api.openai.com/v1

If the certificate is still invalid for you, it's a problem on your local machine and not related to the package.

@bseddon
Copy link

bseddon commented Dec 27, 2022

I had the same problem. The issue is the local PHP configuration as it does not allow cURL to find the certificate bundle it needs to make requests on port 443. The solution is to:

  • Download the latest cacert.pem from https://curl.haxx.se/ca/cacert.pem

  • Add the following line to php.ini: (if this is shared hosting and you don’t have access to php.ini then you could add this to .user.ini in public_html).

Might be handy to include a note in the readme. Great job on the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants