0

PHP (5.6.11-1 on Debian Strech/sid) does not allows me to run two instaces of cli.

I've tried to execute following script two times. First script runs normally. Second one is locked until first one is killed.

#!/usr/bin/env php
<?php
$i = 0;
while (++$i) {
    var_dump($i);
    sleep(1);
}

Do you know what may be reason of that strange behaviour?

Edit: Issue does not occur on other machines. (?)

Edit: Is there something in configuration files of php, that could do that?

  • You do realise you have written an infinite while loop there dont you. Maybe its just hogging all the machine resources. – RiggsFolly Aug 09 '15 at 12:37
  • What resources would lock the second process? There is nothing in that process that could do that. – Łukasz Pijet Aug 09 '15 at 12:39
  • By other machines do you mean other OS's – RiggsFolly Aug 09 '15 at 12:41
  • I could only check at Ubuntu precise – Łukasz Pijet Aug 09 '15 at 12:42
  • Try running PHP directly. Either `php script.php` or changing the shebang line to /usr/bin/php (or wherever php is located). – Devon Bessemer Aug 09 '15 at 12:48
  • Tried that before - no effect. – Łukasz Pijet Aug 09 '15 at 12:50
  • Are you running them as superuser? If not, try it, if it works as a superuser and not a user then it is a system limit somewhere. – Devon Bessemer Aug 09 '15 at 12:55
  • Could be PHP [OPCache](http://php.net/manual/en/opcache.configuration.php) and its potential optimisation for CLI (`opcache.enable_cli`) or [`opcache.optimization_level`](http://stackoverflow.com/q/21181045/55075) giving some side effects, just a guess, so this is the first thing which should be disabled before re-trying again. To debug this, you could run the 2nd script using either `gdb` or `strace` to see why it hangs. – kenorb Aug 09 '15 at 14:00

1 Answers1

0

Issue was caused by something wrong in configuration (still does not know what was it be).

aptitude purge php5 php5-cli
aptitude install php5 php5-cli

Configuration purging helped.