php-general Digest 13 Sep 2013 10:40:53 -0000 Issue 8362

Topics (messages 322069 through 322071):

Re: PHP CLI setting cooked terminal mode
        322069 by: Stuart Dallas
        322070 by: Alain Williams

Ini files for CLI only on non Win32 platform.
        322071 by: Richard Quadling

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 11 Sep 2013, at 17:37, Alain Williams <a...@phcomp.co.uk> wrote:

> Hi,
> 
> I am running a PHP script at the command line and piping the output through 
> less:
> 
>    ./myScript | less
> 
> Since less is an interactive program it puts the terminal into 'raw' mode so
> that it can read characters one at a time. However, when I do the above I find
> that the commands that I type to less are echoed back to me and not acted on
> until I type <RETURN>. This is not as it should be.
> 
> The sript is not doing anything really clever, just looking at a few files and
> printing out directory contents, time stamps, ...
> 
> If I run the script under strace I see:
> 
>    ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo 
> ...}) = 0
>    ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) 
> = 0
> 
> 
> I can get it to not do this by connect stdout to /dev/null:
> 
>    ./myScript > /dev/null | less
> 
> another way of getting it to work is (and this shows that it really is PHP 
> that
> is messing the tty modes):
> 
>    ./myScript > /dev/null | (sleep 10;less)
> 
> However: PHP should not set the terminal to cooked mode in the first place
> 
> Is there any way in which I can get PHP to not do this ?
> 
> TIA
> 
> I am running PHP 5.3.3 on CentOS 6.

Make sure output buffering is off by putting this at the top of your script:

while(ob_end_clean());

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

--- End Message ---
--- Begin Message ---
On Wed, Sep 11, 2013 at 05:45:45PM +0100, Stuart Dallas wrote:
> On 11 Sep 2013, at 17:37, Alain Williams <a...@phcomp.co.uk> wrote:

> Make sure output buffering is off by putting this at the top of your script:
> 
> while(ob_end_clean());

Sorry, that does not fix the problem - but thanks for trying.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

--- End Message ---
--- Begin Message ---
Hi.

I've got an instance of PHP that is looking for additional ini files in
/etc/php.d

This seems to work well.

I now need to make one of the ini files only accessible if the SAPI is CGI.

So, I renamed the file ...

mv /etc/php.d/my.ini /etc/php.d/my-cgi.ini

If I do a ...

php --ini

I still see the ini file.

Is the -SAPI filtering performed on the additional files?

It doesn't seem to and I can't really tell from the dox if it is supposed
to.

Regards,

Richard.
-- 
Richard Quadling

--- End Message ---

Reply via email to