SoapClient issue on CLI cron - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: SoapClient issue on CLI cron (/showthread.php?tid=62684) |
SoapClient issue on CLI cron - arisdario - 08-14-2015 I have created a function that call a Magento SoapClient In traditional PHP if i run it via command php soapcron.php it works Also i put the same code in a function on CI, on web it Works, but on command via CLI cron it doesn't work and give me an error: the traditional php is: PHP Code: $client = new SoapClient('http://www.magento.com/api/soap/?wsdl'); CI Method PHP Code: public function SyncAttributes(){ This method is called in command php /paht/to/ci/index.php Controller SyncAttributes the error is: Code: PHP Notice: Constant ENVIRONMENT already defined in /path/to/ci/index.php on line 57 Line 25 is: $client = new SoapClient('http://www.magento.com/api/soap/?wsdl'); Is there a way to fix it? RE: SoapClient issue on CLI cron - arisdario - 08-18-2015 I figured it out, being a controller under Login and the main requeriment is session, so to get data from database was required to send the request based on user and session id, so from here the fail, i checked the client and this was blank, Resolved ! RE: SoapClient issue on CLI cron - arisdario - 08-18-2015 For this issue: PHP Notice: Constant ENVIRONMENT already defined in /path/to/ci/index.php on line 57 I just deleted the line, and the error has gone ! RE: SoapClient issue on CLI cron - mwhitney - 08-18-2015 (08-18-2015, 01:10 AM)arisdario Wrote: For this issue: PHP Notice: Constant ENVIRONMENT already defined in /path/to/ci/index.php on line 57 Yeah, that's not a good idea. If it has already been defined, some other code must have defined it before you got to this point (which implies you're doing something strange). If you absolutely need that to be possible (and you know ENVIRONMENT will be set to a valid value), you should change it to: PHP Code: defined('ENVIRONMENT') OR define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); |