PHP is a general-purpose scripting language that is mainly used for Web development to built dynamic and interactive web pages. Because of its free availability and efficiency, it is widely used among web developers. It has many extensions to get and use web services to make the website more interactive. One of the famous php extension is the SOAP extension. Simple Object Access Protocol simply called as “SOAP” is a protocol to provide and consume Webservices. The SOAP extension is language and platform independent so, it is widely used and easy to use. It is an XML-based messaging protocol mainly used for message broadcasting. It defines the information which is sent and how it is sent. REST API is the competitor for SOAP extension. Nowadays, REST API is getting popular. You can also use SOAP extensions not only for Web development but also for Mobile applications. So, let us see how to install PHP Soap Extension in this article.
Install PHP Soap Extension
There are two methods to install the SOAP extension for PHP.
- Using XAMPP control panel.
- Find php.ini file inside the php folder inside the XAMPP folder.
Let’s discuss both the methods in detail.
Method 1 – Using XAMPP control panel
To install PHP Soap Extension follow the following steps:
Step 1: Open the XAMPP control panel, where your Apache server will be running. Click config button of the Apache server.
Step 2: You can find PHP (php.ini), select the option and it will open the file which contains PHP extensions in it.
Strep 3: Then search for ;extension=soap in the file using Edit-> Find.
Step 4: Remove the semicolon “;” and save the file.
Step 5: After saving the file, Restart your XAMPP server and your Soap extension is added successfully.
Method 2 – Using php.ini file
To install PHP Soap Extension follow the following steps:
Step 1: If you are using XAMPP as your server the get into the directory XAMPP-> php and search for the file php.ini (File type: Configuration settings) and open the file in Notepad.
Step 2: Then search for ;extension=soap in the file using Edit-> Find.
Step 3: Remove the semicolon “;” and save the file.
Step 4: After saving the file, Restart your XAMPP server. That’s it, the SOAP extension will be installed successfully. Initialize the soap client by the object using the below command.
$object_name = new SoapClient("client_link");
Note: It is mandatory to Restart the server, so that the SOAP extension installation will be updated.