PHP: Fatal error: Class ‘SoapClient’ not found

apachePHPsoap

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.

  1. PHP: php-5.5.17-Win32-VC11-x86. Thread safe.

  2. 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:

enter image description here

I DO NOT have these settings shown:

enter image description here

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?

Best Answer

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.