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 example.com - that wasn’t the actual host I was trying to connect to.
* Hostname example.com was found in DNS cache * Trying 220.127.116.11... * TCP_NODELAY set * Connected to example.com (18.104.22.168) port 443 (#0) * CAfile: none CApath: none * NSS error -8023 (SEC_ERROR_PKCS11_DEVICE_ERROR) * A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot. * Closing connection 0 Exception >>>
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