Saroten Saroten - 2 months ago 15
PHP Question

soap class not found in local

I've got this :

try{
$soap = new SoapClient("https://www.ovh.com/soapi/soapi-re-1.8.wsdl");
$session = $soap->login("$nic", "$pass","fr", false);
$result = $soap->telephonySmsSend($session, "$sms_compte", "$from", "$to", "$message", "", "1", "", "");
$soap->logout($session);
}catch(SoapFault $fault){
echo $fault;
}


The problem is that i've got an error telling me that the class SoapClient is not found.
How to create it ?

Answer

Write the following inside your PHP script file

<?php phpinfo(); ?>

If you can't find Soap Client set to enabled like so:

enter image description here

Do the following:

1.) Locate php.ini in your apache bin folder, I.e Apache/bin/php.ini

2.) Remove the ; from the beginning of extension=php_soap.dll

3.) Restart your Apache server

4.) Look up your phpinfo();

Don't forget to also uncomment this line: ;extension=php_openssl.dll if the WSDL you are trying to reach is under https protocol again and check if you see a similar picture to the one above

If you do, problem solved!

In case if you does not find SOAP section in phpinfo()

For information the SOAP extension requires the libxml PHP extension. This means that passing in --enable-libxml is also required according to http://php.net/manual/en/soap.requirements.php

From WHM panel

.Software » Module Installers » PHP Extensions & Applications Package

.Install SOAP 0.13.0

WARNING: "pear/HTTP_Request" is deprecated in favor of "pear/HTTP_Request2"

install ok: channel://pear.php.net/SOAP-0.13.0

.Install HTTP_Request2 (optional)

install ok: channel://pear.php.net/HTTP_Request2

.Restart Services » HTTP Server (Apache)

From shell command

1.) pear install SOAP

2.) Reboot