First of all, I've read this question (Fatal error: Class 'SoapClient' not found) and have everything done the answer says. But still experience an issue.
I also found similar issue here (https://bugs.php.net/bug.php?id=64445) but it is not solved there too.
I'm trying to set up a PHP + Apache environment on Win 7 64.
PHP: php-5.5.17-Win32-VC11-x86. Thread safe.
Apache: httpd-2.4.10-win32-VC11
So, here is my C:\PHP\php.ini
for SOAP. Everything is set correctly:
extension=php_soap.dll
; Directory in which the loadable extensions (modules) reside.
; On windows:
extension_dir = "C:/PHP/ext"
[soap]
; Enables or disables WSDL caching feature.
; http://php.net/soap.wsdl-cache-enabled
soap.wsdl_cache_enabled=1
; Sets the directory name where SOAP extension will put cache files.
; http://php.net/soap.wsdl-cache-dir
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
; http://php.net/soap.wsdl-cache-ttl
soap.wsdl_cache_ttl=86400
; Sets the size of the cache limit. (Max. number of WSDL files to cache)
soap.wsdl_cache_limit = 5
In C:/PHP/ext
folder I have php_soap.dll
file, C:\PHP\ext\php_soap.dll
.
But my phpinfo();
returns ONLY this about SOAP:
I DO NOT have these settings shown:
And I get error:
Fatal error: Class 'SoapClient' not found in C:\Apache24\htdocs\myApp\src\Em\Bundle\PlatformBundle\Services\MyAppService.php on line 46
What did I miss? How to solve it?
This is very easy.
You work with Symfony2 i think and you use namespaces. This function is in the Root-Namespace.
use:
\SoapClient()
Otherwise you are in the namespace and they can't find the class.
You have the same Problem with the Exception
class for example.
If you are on linux and you are missing the soap extension, like I was and you have already enabled it in php.ini then try
apt-get install php-soap
service apache2 restart
I had the same issue in a custom module Drupal 8.
It uses Symfony2 so just add this in controller :
use SoapClient;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With