LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > [solved] Problem with SoapClient and LiteSpeed

Reply
 
Thread Tools Display Modes
  #1  
Old 01-27-2013, 02:51 AM
Sindre Sindre is offline
Member
 
Join Date: Dec 2008
Posts: 31
Question [solved] Problem with SoapClient and LiteSpeed

Hello,

I am struggling with a strange problem. I have a script which makes a simple Soap request to my Magento API:

PHP Code:
try {
   
$proxy= new SoapClient($host.'/index.php/api/soap/?wsdl',array('exceptions' => 1,'trace' => 1,"connection_timeout" => 120));
   
$sessionId$proxy->login($apiuser$apikey);
   echo  
"Magento Api accessed Successfully.";
   echo 
"<br>Session Id is:"$sessionId;
} catch (
Exception $e) {
   echo 
"==> Error: ".$e->getMessage();

When I run this through a browser I get
Code:
SOAP-ERROR: Parsing WSDL: "Couldn't load from 'http://....../index.php/api/soap/index/wsdl/1/' : failed to load external entity "http://..../index.php/api/soap/index/wsdl/1/"
However, when I run it from the command line it works fine:
Code:
/usr/local/lsws/fcgi-bin/lsphp5 path_to_script
Magento Api accessed Successfully.<br>Session Id is: xxxx
It is the same lsphp5 binary that is configured in LiteSpeed LSAPI external app.

Any ideas? I am sort of out of ideas at the moment.

Last edited by NiteWave; 01-27-2013 at 05:47 PM..
Reply With Quote
  #2  
Old 01-27-2013, 03:09 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
searched the net, your script may need access /etc/hosts

so, check open_basedir, it blocks reading /etc/hosts, disable open_basedir
Reply With Quote
  #3  
Old 01-27-2013, 04:38 AM
Sindre Sindre is offline
Member
 
Join Date: Dec 2008
Posts: 31
Quote:
Originally Posted by NiteWave View Post
searched the net, your script may need access /etc/hosts

so, check open_basedir, it blocks reading /etc/hosts, disable open_basedir
Thanks, but I don't see why the script would need access to the /etc/hosts file? Also, why would it work through the CLI but not in a browser or using WGET? There must be something in LiteSpeed which is blocking the request. It just hangs until the timeout value is reached.
Reply With Quote
  #4  
Old 01-27-2013, 05:54 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
command line lsphp5 and exteral app lsphp5 may pick up different php.ini.

to confirm, check if open_basedir are same value
#/usr/local/lsws/fcgi-bin/lsphp5 phpinfo.php |grep open_basedir

and in browser, access domain.com/phpinfo.php and search open_basedir
Reply With Quote
  #5  
Old 01-27-2013, 06:04 AM
Sindre Sindre is offline
Member
 
Join Date: Dec 2008
Posts: 31
Quote:
Originally Posted by NiteWave View Post
command line lsphp5 and exteral app lsphp5 may pick up different php.ini.

to confirm, check if open_basedir are same value
#/usr/local/lsws/fcgi-bin/lsphp5 phpinfo.php |grep open_basedir

and in browser, access domain.com/phpinfo.php and search open_basedir
I already checked that. The same php.ini is used both by the CLI and LiteSpeed. open_basedir is not set.

Code:
# /usr/local/lsws/fcgi-bin/lsphp5 -i | grep open_basedir
open_basedir => no value => no value
Reply With Quote
  #6  
Old 01-27-2013, 06:12 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
then strace lsphp5 process when access the php script in browser, check the output of strace, you may get clue there.
Reply With Quote
  #7  
Old 01-27-2013, 12:13 PM
Sindre Sindre is offline
Member
 
Join Date: Dec 2008
Posts: 31
Finally!! I just found the problem. In my LSWS config, the PHP suEXEC Max Conn was set to 2. I increased it to 3 and now it works

Not sure why, but this setting has an impact on the behavior of the SoapClient.
Reply With Quote
  #8  
Old 01-28-2013, 10:20 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,337
the default is 5. maybe you changed that settings in the past for some reason. anyway, it is a bit of surprise to see the impact you described.
Reply With Quote
  #9  
Old 01-28-2013, 02:21 PM
Sindre Sindre is offline
Member
 
Join Date: Dec 2008
Posts: 31
Yes, it was changed in order to better manage the resources on the server (it is used for shared web hosting). My only guess is that the SoapClient creates a new socket which counts as a suexec process, but it is kind of strange indeed.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:23 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.