
Introduction
It seems you’re encountering an issue related to the SoapClient class not being enabled on your server, which can affect the functionality of plugins that rely on SOAP (Simple Object Access Protocol) for communication. To enable the Soap Client on Ubuntu server, you need to install the PHP SOAP extension and restart your web server.
Here’s a step-by-step guide to Enable SOAP Client on Ubuntu:
1- Update the System
First, make sure your system’s package list is up to date.
sudo apt update2- Install the PHP SOAP Extension
Install the PHP SOAP extension for your PHP version. Use the appropriate PHP version number (e.g., php7.4, php8.3, etc.). You can check your PHP version by running:
php -vThen install the SOAP extension:
For PHP 7.4:
sudo apt install php7.4-soapPHP 8.1:
sudo apt install php8.1-soapFor PHP 8.3:
sudo apt install php8.3-soap3. Restart Your Web Server
After the SOAP extension is installed, restart your web server to apply the changes.
For Apache:
sudo systemctl restart apache2For Nginx with PHP-FPM:
sudo systemctl restart php7.4-fpm # Replace with your PHP version
sudo systemctl restart nginx4. Verify SOAP is Enabled
To confirm that SOAP is successfully enabled, create a phpinfo.php file in your web server’s document root.
- Create a file named
phpinfo.php:
sudo nano /var/www/html/phpinfo.php- Add the following content:
<?php
phpinfo();
?>- Save the file and exit (
Ctrl + X, thenY, thenEnter). - Visit the file in your browser (e.g.,
http://your-server-ip/phpinfo.php). - Look for the “SOAP” section in the output. If you see it, that means the SOAP extension is enabled.
5. Remove the phpinfo.php File
For security reasons, remove the phpinfo.php file after checking the information.
sudo rm /var/www/html/phpinfo.php6. Optional: Install the SoapClient class for CLI (Command Line)
If you’re using PHP in CLI mode and need SoapClient there as well, make sure the PHP SOAP extension is installed for the command-line interface:
For PHP 7.4:
sudo apt install php7.4-cli php7.4-soapFor PHP 8.0:
sudo apt install php8.0-cli php8.0-soap7. Test the SOAP Client
After everything is set up, you can create a simple PHP script to test if the SoapClient class works correctly:
<?php
try {
$client = new SoapClient("http://www.dneonline.com/calculator.asmx?WSDL");
$result = $client->Add(array('intA' => 1, 'intB' => 2));
echo "Result: " . $result->AddResult;
} catch (SoapFault $e) {
echo "Error: " . $e->getMessage();
}
?>If you’re on a shared hosting environment or if you don’t have root access to the server, it might be easier to contact your hosting provider’s support team and ask them to enable the SoapClient extension for you.
After enabling SOAP, your gateway plugins should work as expected!
How to Set Up Nginx with Certbot for HTTPS on Your WordPress Website
How to Install WordPress with Nginx on Ubuntu 22.0.4