# ApiException occurred: SSL certificate problem: unable to get local issuer certificate

**URL:** <https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569>\
**Category:** Questions\
**Created:** [November 13, 2022, 11:19pm UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569 "2022-11-13T23:19:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkdiscgolf](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@pkdiscgolf](https://developer.squareup.com/forums/u/pkdiscgolf)\
**Post date:** [November 13, 2022, 11:19pm UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569/1 "2022-11-13T23:19:25Z")

</div>

I am running into this error when trying to get the quickstart running in php ([https://developer.squareup.com/docs/sdks/php/quick-start](https://developer.squareup.com/docs/sdks/php/quick-start))

Has anyone experienced this? Is there any suggestions for debuging this problem? Currently trying to connect to the api and then i hope to connect to the loyalty api, I would like to get this running locally and eventually put on the production server

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 14, 2022, 6:07pm UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569/2 "2022-11-14T18:07:12Z")

</div>

HTTPS is required for all API calls to Square endpoints. Make sure your website is served using HTTPS and that you are making [HTTPS calls to Square APIs](https://developer.squareup.com/docs/build-basics/general-considerations/tls-and-https). Are you using localhost to test or is this a custom host? If its custom is it `http` or `https`? 🙂

---

<div class="post-metadata">

**Author:** ![pkdiscgolf](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@pkdiscgolf](https://developer.squareup.com/forums/u/pkdiscgolf)\
**Post date:** [November 14, 2022, 8:19pm UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569/3 "2022-11-14T20:19:56Z")

</div>

Following along with the quickstart guide, I am using localhost [http://localhost:8000/quickstart.php](http://localhost:8000/quickstart.php)

When i try using [https://localhost:8000/quickstart.php](https://localhost:8000/quickstart.php) “The page cannot be found”

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 14, 2022, 8:30pm UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569/4 "2022-11-14T20:30:34Z")

</div>

Is the server running on the terminal in the correct directory? `php -S localhost:8000` 🙂

---

<div class="post-metadata">

**Author:** ![pkdiscgolf](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@pkdiscgolf](https://developer.squareup.com/forums/u/pkdiscgolf)\
**Post date:** [November 14, 2022, 8:41pm UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569/5 "2022-11-14T20:41:09Z")

</div>

Yea…I believe the terminal is running in the correct directory. I used the gitbash terminal on my Vscode, and ran the code that starts the server in that directory. I am able to get this example working live on my server when i try. But not on localhost.

---

<div class="post-metadata">

**Author:** ![pkdiscgolf](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@pkdiscgolf](https://developer.squareup.com/forums/u/pkdiscgolf)\
**Post date:** [November 14, 2022, 8:42pm UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569/6 "2022-11-14T20:42:07Z")

</div>

Also, can I test using the customers/loyalty APIs without using my credit card? I want to get all of this working before i commit my credit card. But on the Square Seller side it wants me to pay to add a customer into the database.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 14, 2022, 9:40pm UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569/7 "2022-11-14T21:40:22Z")

</div>

That sounds like it’s not running in the right directory if you’re able to get it to run in your production server.

Yeah, you can definitely use our [Sandbox](https://developer.squareup.com/docs/devtools/sandbox/overview) to test prior to going live. 🙂

---

<div class="post-metadata">

**Author:** ![marine0516](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@marine0516](https://developer.squareup.com/forums/u/marine0516)\
**Post date:** [November 22, 2022, 11:05am UTC](https://developer.squareup.com/forums/t/apiexception-occurred-ssl-certificate-problem-unable-to-get-local-issuer-certificate/7569/8 "2022-11-22T11:05:43Z")

</div>

1. download cacert.pem file ([https://curl.haxx.se/ca/cacert.pem](https://curl.haxx.se/ca/cacert.pem))  
2.Put the file in a path, example c:\wwwRoot\curlFile  
3.open the php.ini  
4.find curl.cainf= and change curl.cainfo =“C:\wwwRoot\curlFile\cacert.pem”  
5.reboot web service  
6.done
