# Laminas\\Soap\\Client Error: "SoapClient::\_\_doRequest(): Failed to enable crypto". PHP-FPM?

**URL:** <https://discourse.laminas.dev/t/laminas-soap-client-error-soapclient-dorequest-failed-to-enable-crypto-php-fpm/2631>\
**Category:** Components & MVC\
**Tags:** laminas-soap\
**Created:** [December 2, 2021, 6:10pm UTC](https://discourse.laminas.dev/t/laminas-soap-client-error-soapclient-dorequest-failed-to-enable-crypto-php-fpm/2631 "2021-12-02T18:10:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vigcraig](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/vigcraig/32/819_2.png) [@vigcraig](https://discourse.laminas.dev/u/vigcraig)\
**Post date:** [December 2, 2021, 6:10pm UTC](https://discourse.laminas.dev/t/laminas-soap-client-error-soapclient-dorequest-failed-to-enable-crypto-php-fpm/2631/1 "2021-12-02T18:10:41Z")

</div>

I am getting an error when making a request via the browser using the Laminas Soap library.  
The same code would work via cli.  
I get errors like:

- Failed to enable crypto
- OpenSSL Error messages: error:14090086:SSL routines:ssl3\_get\_server\_certificate:certificate verify failed

One cause it could be was that we recently started using PHP-FPM with Apache, and before this, this code ran fine.  
Is there some extra steps required for PHP\_FPM to work in OpenSsl?

Some help or guidance would be appreciated

```auto
//context was added as a trouble shooting attempt, but had no affect
            $context = stream_context_create([
                'ssl' => [
                    // set some SSL/TLS specific options
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                ]
            ]);
            
            
            // Using Zend Soap
            $xmlvar = new \SoapVar($request, XSD_ANYXML);
            $client = new Client($this->getWsdlFile(),
                array('local_cert'	=> $this->getCertFile(),                
                    'encoding' => $this->getEncoding(),
                    'soap_version'=> $this->getSoapVersion(),
                    'stream_context' => $context
                )
           );

```

Using PHP 7.3.  
OpenSSL is installed in php.ini

## Openssl

| OpenSSL support | enabled |
| --- | --- |
| OpenSSL Library Version | OpenSSL 1.0.2u 20 Dec 2019 |
| OpenSSL Header Version | OpenSSL 1.0.2u 20 Dec 2019 |
| Openssl default config | /usr/local/openssl-1.0.2u/ssl/openssl.cnf |

| Directive | Local Value | Master Value |
| --- | --- | --- |
| openssl.cafile | _no value_ | _no value_ |
| openssl.capath | _no value_ | _no value_ |

---

<div class="post-metadata">

**Author:** ![vigcraig](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/vigcraig/32/819_2.png) [@vigcraig](https://discourse.laminas.dev/u/vigcraig)\
**Post date:** [December 8, 2021, 2:07pm UTC](https://discourse.laminas.dev/t/laminas-soap-client-error-soapclient-dorequest-failed-to-enable-crypto-php-fpm/2631/2 "2021-12-08T14:07:39Z")

</div>

This, for me was solved by specifying the location of the cafile and capath in the php.ini file:

openssl.cafile=/etc/ssl/certs/xxxx.crt  
openssl.capath=/etc/ssl/certs/

Not sure what changed after the server upgrade that this suddenly was needed, perhaps this is a requirement of php-fpm.

Obviously needed to restart apache and probably php-fpm.
