PHP curl / libcurl error on subsequent requests

I’ve been getting the following error recently when making multiple calls using PHP curl (specifically Laravel’s artisan tinker)

To note the domain/IP has been anonymised, I am aware that the domain is – that wasn’t the actual host I was trying to connect to.

* Hostname was found in DNS cache
* Trying
* Connected to ( port 443 (#0)
* CAfile: none
 CApath: none
* A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot.
* Closing connection 0

Through plenty of Googlin’ and wasting quite honestly too much time on this I found the following command that fixes the issue. I would only advise running this on your dev machine just to get things working and not necessarily do it in production. Having said that I’ve only noticed this issue occurring in the tinker shell, I don’t believe it’s a problem for regular running webapps.


As mentioned in the comment that suggested this,

Once this is done, no more errors occur. That said, Mozilla clearly states it’s an error to do this but I couldn’t find an explanation as to why, which makes me a bit uneasy.

Your mileage may vary but if like me you’re just looking for a quick fix so you can get some darned dev work done, this’ll sort it for you. To revert the change you can use


Sign up for emails about the things

Sign up to my (at most) weekly mail list. I'll send general updates to the list, new projects and whatnot. Not every single post as it comes out, but a summary mixed in with random cool tech I find around the net. For more info checkout the subscribe page

I'll never sell, give, transfer, trade your contact details with any other person, company, or other entity and you're free to click that big unsubscribe link at the bottom of each message whenever!