php5-cli scripts not running in background, stays stopped.

Bug #907905 reported by Pablo Bangueses
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Invalid
Low
Unassigned

Bug Description

Description: Ubuntu 10.04.3 LTS
Release: 10.04

php Version
=========

PHP 5.3.2-1ubuntu4.11 with Suhosin-Patch (cli) (built: Dec 13 2011 18:45:32)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans

Additional Modules
--------------------------

    readline
    sysvsem
    sysvshm

Example
=======

~$ cat script.php
<?php

for($i = 0; $i < 4; $i++) {
    fwrite(STDOUT, $i.PHP_EOL);
    sleep(3);
}

?>

~$ php script.php &
[1] 15825
~$

[1]+ Stopped php script.php
~$ fg
php script.php
0
1
2
3

~$

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: php5-cli 5.3.2-1ubuntu4.11
ProcVersionSignature: Ubuntu 2.6.32-37.81-generic 2.6.32.49+drm33.21
Uname: Linux 2.6.32-37-generic i686
Architecture: i386
Date: Thu Dec 22 17:57:01 2011
ProcEnviron:
 LANGUAGE=es_UY:en
 PATH=(custom, user)
 LANG=es_UY.UTF-8
 SHELL=/bin/bash
SourcePackage: php5

Revision history for this message
Pablo Bangueses (pablobngs) wrote :
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I agree that I would expect a Unix application to continue writing its output even when started in the background. But I am not sure whether what you are seeing is expected behaviour for a PHP application or not.

I'm setting this to Importance: Low as per https://wiki.ubuntu.com/Bugs/Importance as this is an unusual configuration unlikely to affect many people.

Before developers can look at this, we need to know whether this is a problem in Ubuntu's packaging of PHP or a problem with PHP itself. If the bug is definitely in PHP itself, then the best thing to do would be to file a bug with upstream directly at https://bugs.php.net/ and then that bug can be linked to from here.

Are you able to determine the answer to this question? I suggest that you might start by building PHP directly from the upstream source and see if you can still reproduce the issue.

Changed in php5 (Ubuntu):
importance: Undecided → Low
Revision history for this message
Pablo Bangueses (pablobngs) wrote :

I have 2 built PHP versions from sources and I cannot reproduce this issue, they run in background.

~$ /opt/php5_2/bin/php -v
PHP 5.2.11 (cli) (built: Dec 15 2009 18:21:33)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

~$ /opt/php5_3/bin/php -v
PHP 5.3.1 (cli) (built: Dec 15 2009 17:51:46)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

Hope this helps.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in php5 (Ubuntu):
status: New → Confirmed
Revision history for this message
Jakob Unterwurzacher (jakobunt) wrote :

Caused by the readline module and cannot be avoided.
From http://php.net/manual/en/book.readline.php :
When readline is enabled, php switches the terminal mode to accept line-buffered input. This means that the proper way to use the cli when you pipe to an interactive command is to explicitly specify that php is not using the terminal for input:

php somescript.php < /dev/null | less

Changed in php5 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.