Is this Windows or Linux?
"SoapClient class not found" generally means that SOAP has not been enabled. Does it work if invoked from a browser?
Are you using the built-in SOAP stuff or something like NuSoap?
Is this Windows or Linux?
"SoapClient class not found" generally means that SOAP has not been enabled. Does it work if invoked from a browser?
Are you using the built-in SOAP stuff or something like NuSoap?
using built in soap, in linux. soap works fine from a browser.
this specific script works from a browser as well
Hmmmm - that is exactly what I have and it works fine from CLI.
What does the soap section from phpinfo say? This is what mine says:
Soap Client enabled
Soap Server enabled
Directive Local Value Master Value
soap.wsdl_cache 1 1
soap.wsdl_cache_dir /tmp /tmp
soap.wsdl_cache_enabled 1 1
soap.wsdl_cache_limit 5 5
soap.wsdl_cache_ttl 86400 86400
there is no soap section when running phpinfo from cli
thats basically my problem, its not enabled and i cannot figure out how to enable it
OK, so now I'm totally confused.
There MUST be a soap section output from phpinfo() otherwise these two statements could not be true:
soap works fine from a browser.
this specific script works from a browser as well
Actually, they could be true if you were not using PHP's SOAP and were using a different SOAP (eg. Apache Axis) but, basically, if you have a PHP script that creates a (PHP5 built-in) SOAP client that works, you have to have a soap section as part of phpinfo() output.
Also, this statment has me confused:
So i am running it using exec to run it in the background.
Why would you need to exec a program from php when you are at the commandline already? If execing works, then just run the program.
ok, exec is being used to run a background script that is detached from the web script. so the user is on a page in their browser, they submit a form, and the script on the webpage uses exec to split the execution of a time consuming script away, so the user can continue on while the long script is run in the background
so soap is working from apache, but when i call exec, the script that i am running is not able to access the soap classes.
let me know if its still confusing
OK, now I understand. You are just doing a
exec('php myclient.php');
which is giving the error.
If you go to the command line and do
php myclient.php
i assume it also doesn't work.
What I don't understand is how a PHP SOAP client can work from the browser without a SOAP section in phpinfo().
OK, just had a thought.
You may have multiple copies of PHP on your server. The one Apache is using that has the SOAP library and the one set in your path that is being executed on the command line.
What does phpinfo() say about the location and version of PHP?
What does the CLI say about the location and version of PHP?
there is a soap section in phpinfo() when its called from the browser, just not when called from the command line
unfortunately the server that im working on is not responding right now. so ill get back to you when its back online with that.
there is a soap section in phpinfo() when its called from the browser, just not when called from the command line
Yep - that means that you are running a different PHP binary when on the command line than Apache is using. You will need to modify your $path or explicitly set the path when you do the exec (Or anytime you invoke php from the command line).
ok thx.
how do i set the path when i call exec?
Well, you would need to find out where the php binary is that Apache is using. It depends on where it was installed when it was installed. In my case it is at /usr/bin/php. Useful commands are:
whereis php
echo $path
php -v
So, when you do your exec it would be:
exec('/usr/bin/php "myclient.php"');
ok ill try that out. much appreciation for the help