Re: [jplatform] CLI STDIN/STDOUT

179 views
Skip to first unread message

Mark Dexter

unread,
Mar 24, 2013, 2:14:24 PM3/24/13
to joomla-de...@googlegroups.com
For your situation you can of course just override the contstuctor in your child class. I don't know the answer about how common this issue is. Mark

On Sun, Mar 24, 2013 at 9:38 AM, Roger Abt <klamm...@gmail.com> wrote:
Hi Folks

I wrote a little cli-app. No Problems so far on localhost (apache on windows), but it won't run on my hosting account (apche on linux).

I figured out, that's because the first if-statement in the contructor of JApplicationCli (wich is inherited from my cli class):

if (!defined('STDOUT') || !defined('STDIN') || !isset($_SERVER['argv']))
{
   $this->close();
}

On my linux-account, it seems that STDIN and STDOUT are not defined explicit by the php-cli-environment. If I commented this statement out, the script works.

So, the question (to the server-experts out there) now is:

- Is that a exception, is my hosting-account not properly configuratetd? That would be no problem, then I do a workaround in the script and/or talk to my hosting-provider.

- Or is that a common possible environment configuration? If so, then we have to change that statement in JApplicationCli, I think, to deal with those cases of server-configs too.

Any toughts, tipps and hints are welcome,
as I am not a server geek ;)

Cheers
Roger

--
You received this message because you are subscribed to the Google Groups "Joomla! Platform Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-plat...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Bill Tomczak

unread,
Mar 24, 2013, 4:08:16 PM3/24/13
to joomla-de...@googlegroups.com
This came up for me as well. But I also had need to use the JApplicationCli::out() method which also needs to be overridden if you plan to use it.

-bill
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-platform+unsub...@googlegroups.com.

Andrew Eddie

unread,
Mar 24, 2013, 8:01:00 PM3/24/13
to JPlatform
Sounds like it's a buggy PHP implementation on your host.

Regards,
Andrew Eddie
http://learn.theartofjoomla.comfree tutorials and videos on Joomla development


On 25 March 2013 02:38, Roger Abt <klamm...@gmail.com> wrote:
Hi Folks

I wrote a little cli-app. No Problems so far on localhost (apache on windows), but it won't run on my hosting account (apche on linux).

I figured out, that's because the first if-statement in the contructor of JApplicationCli (wich is inherited from my cli class):

if (!defined('STDOUT') || !defined('STDIN') || !isset($_SERVER['argv']))
{
   $this->close();
}

On my linux-account, it seems that STDIN and STDOUT are not defined explicit by the php-cli-environment. If I commented this statement out, the script works.

So, the question (to the server-experts out there) now is:

- Is that a exception, is my hosting-account not properly configuratetd? That would be no problem, then I do a workaround in the script and/or talk to my hosting-provider.

- Or is that a common possible environment configuration? If so, then we have to change that statement in JApplicationCli, I think, to deal with those cases of server-configs too.

Any toughts, tipps and hints are welcome,
as I am not a server geek ;)

Cheers
Roger

--
You received this message because you are subscribed to the Google Groups "Joomla! Platform Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-plat...@googlegroups.com.

El KuKu

unread,
Mar 25, 2013, 10:06:38 AM3/25/13
to joomla-de...@googlegroups.com

I would guess that php is compiled as  cgi where stdin and stdout are not defined.

Bill Tomczak

unread,
Mar 25, 2013, 2:47:58 PM3/25/13
to joomla-de...@googlegroups.com
On the server where I have a cli app running, it's only an issue when the job runs via cron. Running it from a shell command line, STDIN/STDOUT are defined and usable. It may be a buggy installation of php, but since this is a server over which I have no control, and my app needs to run as a cron job, doing these couple of simple overrides was really the only viable solution.

-bill



On Monday, March 25, 2013 7:06:38 AM UTC-7, Nikolai Plath wrote:

I would guess that php is compiled as  cgi where stdin and stdout are not defined.

On Mar 24, 2013 7:01 PM, "Andrew Eddie" <mamb...@gmail.com> wrote:
Sounds like it's a buggy PHP implementation on your host.

Regards,
Andrew Eddie
http://learn.theartofjoomla.comfree tutorials and videos on Joomla development


On 25 March 2013 02:38, Roger Abt <klamm...@gmail.com> wrote:
Hi Folks

I wrote a little cli-app. No Problems so far on localhost (apache on windows), but it won't run on my hosting account (apche on linux).

I figured out, that's because the first if-statement in the contructor of JApplicationCli (wich is inherited from my cli class):

if (!defined('STDOUT') || !defined('STDIN') || !isset($_SERVER['argv']))
{
   $this->close();
}

On my linux-account, it seems that STDIN and STDOUT are not defined explicit by the php-cli-environment. If I commented this statement out, the script works.

So, the question (to the server-experts out there) now is:

- Is that a exception, is my hosting-account not properly configuratetd? That would be no problem, then I do a workaround in the script and/or talk to my hosting-provider.

- Or is that a common possible environment configuration? If so, then we have to change that statement in JApplicationCli, I think, to deal with those cases of server-configs too.

Any toughts, tipps and hints are welcome,
as I am not a server geek ;)

Cheers
Roger

--
You received this message because you are subscribed to the Google Groups "Joomla! Platform Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-platform+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Joomla! Platform Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-platform+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages