The Developer Day | Staying Curious

Aug/07

17

PHP SoapClient certificate problems

I’ve been working with SoapClient and certificates for some time. I recently switched my old workstation to a new one and while working with a piece of code that seemed to work fine I got an error like this:

Unable to set local cert chain file `filename.pem’; Check that your cafile/capath settings include details of your certificate and its issuer in somescript.php on line ##

I tried to google what the problem might be and found a comment that you can get this error if you have curl extension disabled. But in my case it was enabled and working fine. I tried to remember what extensions I had enabled on my previous box and after a few thoughts I decided to enable mcrypt extension which seems related to crypted certificates and after restarting my webserver everything started working fine.

The php soapclient documentation does not mention anything that soapclient is dependency related to curl or mcrypt.

RSS Feed

4 Comments for PHP SoapClient certificate problems

HB | December 10, 2008 at 8:40 PM

I’m having the same problem, and mcrypt and curl are both enabled on my box. I don’t suppose you found any other possibilities while looking for your answer on this?

Author comment by admin | December 11, 2008 at 12:09 PM

Sorry. I didn’t. You could try enabling all your extensions and see if it extension related. Also try to use the latest php version and check if your certficate is ok.

HB | January 12, 2009 at 8:52 PM

Got mine to work, it seemed to be a number of odd issues. The two big ones: PHP’s SOAP stuff requires error_reporting(0) if you’re using SSL, and local_cert only recognizes relative paths on *nix boxes. My dev server is Windows, so I had to use something like C:\\absolute\path\to\certificate.pem

Still not sure why the first slash needs to be escaped but the rest don’t. Silly PHP.

Also I was only provided with a .crt and .pfx file, so my initial conversion to .pem may have been incorrect ;) Anyway, I’m glad I ran across this post on my trek through SOAP.

Ted Yu | June 26, 2009 at 8:13 PM

How do I pass certificate to SoapClient in php 5 ?

Thanks

Leave a comment!

<<

>>

Find it!

Theme Design by devolux.org