Runs php script in cmd with Curl

Asked

Viewed 180 times

1

I am testing an api, while trying to use some features presented the following message:

Something Went Wrong: Network: CURL error 60: SSL Certificate problem: Unable to get local Issuer Certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html).

By searching I found that it was necessary to add the certificate cacert.pem in php.ini in this way:

curl.cainfo = "C:/wamp64/bin/php/php5.6.25/extras/ssl/cacert.pem"

It worked perfectly, however I need to run a certain code of the api that only works on the terminal(cmd) and when trying to run it presents this same message that appeared in the browser:

Something Went Wrong: Network: CURL error 60: SSL Certificate problem: Unable to get local Issuer Certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html).

I tried to install Curl-7.46.0-Win64.exe, now Curl works on the terminal, but the message when trying to run the api persists.

Api: https://github.com/mgp25/Instagram-API

I’m trying to run the example: "pushReceiver.php"

Update

I thought it could be the php version since wamp has two, 5 and 7, but both return the same message:

c:\wamp64\bin\php\php5.6.25>php.exe C:\wamp64\www\Instagram\index.php
Something went wrong: Network: CURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html).

c:\wamp64\bin\php\php5.6.25>cd ..

c:\wamp64\bin\php>cd php7.0.10

c:\wamp64\bin\php\php7.0.10>php.exe C:\wamp64\www\Instagram\index.php
Something went wrong: Network: CURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html).
  • of curiosity, why use Curl instead of simply calling php.exe index.php?

1 answer

1


In the wamp folder there is more than one php.ini file, I had to change in all to work, this was the problem.

Folders where php.ini files are found:

C:\wamp64\bin\apache\apache2.4.23\bin
C:\wamp64\bin\php\php7.0.10
C:\wamp64\bin\php\php5.6.25

That is, it was working via browser because the browser php.ini is configured, but the console is not.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.