Today, I was creating a web service through SOAP Client in PHP. Unfortunately, I got below fatal error “Class ‘SoapClient’ not found” on applications. I spent some time on Google to find a solution and found a working solution.
Here, I am sharing my understanding regarding this error. This error can occur on Linux as well as Windows systems.
Check out other PHP SOAP Tutorials,
There are several reasons for this error to occur:
php-soap
installed into the system.php.ini
file.Locate the php.ini
file into xampp or wamp folder, The location would be your Apache bin folder, I.e Apache/bin/php.ini
By default, it looks like this:;extension=php_soap.dll
It should appear like this:extension=php_soap.dll
Let’s Restart your Apache server.
You can check if PHP SOAP is enabled by using phpinfo. Open phpinfo
(typically found at localhost/dashboard/phpinfo.php
in XAMPP), then search for 'soap'
. If you find the soap extension listed as shown below, it means you are ready to run SOAP services:
Even if you are getting the same error on the Windows system that means your extension directory path is not set.
It might be your extension_dir
path sets a relative path.
You need to un-comment the extension_dir
line if it’s commented into php.ini
file. rather, you may have to set an absolute path to the extensions directory.
Un-Comment extension_dir into php.ini file
We will open the php.ini file and search extension_dir into this file. By default, it looks like this:;extension_dir="ext"
Ensure it appears as follows:extension_dir="C:/php/ext"
We have addressed Class ‘SoapClient’ not found” error. we can fix it by ensuring the presence of necessary modules and correctly configuring php.ini.
This tutorial helps integrate a PHP SDK with Laravel. We'll install aws-php-sdk into laravel application and access all aws services… Read More
in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More
This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More
We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More
in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More
I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More
View Comments
I had the same error... when I test code at the separate page - everything be OK, but when I include it into the target page - the error appeared.
The solution is - input symbol " " before Class name => SoapClient(...)
everything works! :)
Where to find php_info???
you can get php information in your hosted PHP server, I am using xampp to run PHP application, the phpinfo path is : localhost/dashboard/phpinfo.php