Php

Fatal error: Class Soap Client not found

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:

  • Linux: You do not have php-soap installed into the system.
  • Windows: You have not un-commented the following line out from the 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.

Related Post

Verify Soap Client Using php.ini

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"

Conclusion

We have addressed Class ‘SoapClient’ not found” error. we can fix it by ensuring the presence of necessary modules and correctly configuring php.ini.

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! :)

    • 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

Recent Posts

Configure and Retrieve S3 Information Using Laravel PHP-AWS-SDK

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

4 months ago

What is the Purpose of php_eol in PHP?

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

10 months ago

Laravel Table Relationship Methods With Example

This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More

10 months ago

Exploring the Power of Laravel Eloquent Join?

We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More

10 months ago

Quick and Easy Installation of Laravel Valet

in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More

11 months ago

What is Laravel Soft Delete and How Does it Work?

I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More

11 months ago

Categories