2

I am using PHP 7.4 and Laravel 8 to create an app.

I am trying to send an SMS like this:

... ... $this->client = new \SoapClient('http://ippanel.com/class/sms/wsdlservice/server.php?wsdl'); $this->user = '****'; $this->pass = '****'; $this->fromNum = '****'; ... ... 

But I get this error:

Error: Class 'SoapClient' not found in /usr/local/lsws/IRMine/html/core/app/Classes/ippanelSMS.php

And I already installed and enabled php-soap in my server:

phpinfo

So what could my problem be??

14
  • 1
    Have you tried removing the ; from the beginning of extension=php_soap.dll in php.ini? And restart your server. Commented Aug 17, 2021 at 5:19
  • Q: Do you have use SoapClient; anywhere? Commented Aug 17, 2021 at 5:21
  • i installed the soap using command and i did not have this line in php.ini, but yes i added this line to the file and restart the server and the problem still exist Commented Aug 17, 2021 at 5:23
  • 1
    stackoverflow.com/questions/11391442/… Commented Aug 17, 2021 at 5:25
  • 1
    Well, SOAP is an XML-based protocol. And as far as I remember it is a prerequisite. Do you have the PHP libxml extension enabled (although I think the SOAP extension could not be enabled without libxml being already active)? Commented Aug 17, 2021 at 7:54

2 Answers 2

1

First use should check your if your module is really loaded by execution this command:

var_dump(extension_loaded('soap')); 

Also you should check the path of your loaded configuration

var_dump( get_cfg_var('cfg_file_path') ); 

It could be that the module is only activated for the CLI, so you should double check that your configuration is correct.

Sign up to request clarification or add additional context in comments.

4 Comments

thank you. the first output was: bool(true). and the second: string(35) "/usr/local/lsws/lsphp74/etc/php.ini".
There's nothing wrong with using \SoapClient (with the explicit `\`). In fact, it might not work without it if there is a namespace declaration in the file calling the Soap client; and since it is a Laravel app, there's a strong chance there is a namespace declaration at the top of the file.
Thanks @ZoliSzabó - i improved my answer.
thanks guys. it seems i installed and enabled the soap in my server well. but the error still exist
0

I encountered the same issue and simply solved it by removing the

; 

at the beginning of:

extension=soap 

Restarted the command prompt, and ran

php artisan serve 

And it worked

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.