About Jay Jay

Hi there. My name is John Elliot V. My friends call me Jay Jay. I talk about technology on my blog at blog.jj5.net and make videos about electronics on my YouTube channel @InTheLabWithJayJay.

Piping PHP CLI output to less broken

Today I had an interesting problem.

When I ran:

 # php test.php | less

The ‘less’ program entered input mode and the up and down arrow (and j, k keys) weren’t working.

Eventually I figured out a solution:

 # php test.php < /dev/null | less

The PHP CLI seems to be interfering with the terminal and piping in /dev/null to PHP CLI stdin fixes the problem!