Bug #69421 [Opn]: getopt() fails when daemoning php file
| From: | nanocaiordo at gmail dot com | Date: | Sat, 11 Apr 2015 11:13:48 +0000 |
| Subject: | Bug #69421 [Opn]: getopt() fails when daemoning php file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191961@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69421&edit=1
ID: 69421
User updated by: nanocaiordo at gmail dot com
Reported by: nanocaiordo at gmail dot com
Summary: getopt() fails when daemoning php file
Status: Open
Type: Bug
Package: CGI/CLI related
Operating System: CloudLinux 6.6
PHP Version: 5.4.39
Block user comment: N
Private report: N
New Comment:
All good with PHP 5.5.23
Previous Comments:
------------------------------------------------------------------------
[2015-04-10 17:34:15] nanocaiordo at gmail dot com
Description:
------------
getopt() return false when daemonizing a PHP script, $argv is properly filled up with all the
arguments but getopt() keeps returning false.
Calling the script without 'deamon --pidfile' does work, however something strange is that
it outputs X-Powered-By and Content-type in CLI when getopt() fails.
Test script:
---------------
test.sh
#!/bin/bash
. /etc/rc.d/init.d/functions
daemon --pidfile=test.pid test.php -P Pdegub
test.php
#!/usr/bin/env php
<?php
error_reporting(-1);
ini_set('display_errors', 1);
exit(var_dump(getopt('P:')));
Expected result:
----------------
sh ./test.sh
array(1) {
["P"]=>
string(6) "Pdebug"
}
Actual result:
--------------
sh ./test.sh
X-Powered-By: PHP/5.4.39
Content-type: text/html
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69421&edit=1