|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52495 "-d" not parsed when invoked via shebang
Submitted: 2010-07-30 08:30 UTC Modified: 2010-07-30 09:48 UTC
From: php-bugs at thequod dot de Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.3.3 OS: Linux
Private report: No CVE-ID:
 [2010-07-30 08:30 UTC] php-bugs at thequod dot de
The behavior of PHP when used via shebang line in a script is different from using it directly:

# cat > ~/test.php
#!/usr/bin/php -n -ddate.timezone=Europe/Lisbon

# chmod +x ~/test.php

# ~/test.php ; echo $?
Usage: php [options] [-f] <file> [--] [args...]
  -d foo[=bar]     Define INI entry foo with value 'bar'

However, when used directly from the command line, the space after "-d" appears to be optional:

# php -n -ddate.timezone=Europe/Lisbon -r 'echo date("H:i");'
# php -n -d date.timezone=Europe/Lisbon -r 'echo date("H:i");'

Please make the invocation via shebang behave the same in this regard (accept "-dfoo=bar")


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-30 08:47 UTC] php-bugs at thequod dot de
-Summary: "-d" parsed inconsistenly when invoked via shebang +Summary: "-d" not parsed when invoked via shebang
 [2010-07-30 08:47 UTC] php-bugs at thequod dot de
Well, it's actually worse than that: "-d" cannot be used in a shebang line altogether.

This fails also:
#!/usr/bin/php -n -d date.timezone=Europe/Lisbon

# cat /usr/local/bin/php-noini
/usr/bin/php -n -d Europe/Lisbon "$@"
 [2010-07-30 09:45 UTC] php-bugs at thequod dot de
Sorry, this is apparently a limitation of the shebang handling, where no argument splitting is performed.

Therefore, this bug is invalid.

But please get bug 52496 fixed, so this does not fail silently.
 [2010-07-30 09:48 UTC]
-Status: Open +Status: Bogus
 [2010-07-30 09:48 UTC]
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Wed Apr 01 03:02:10 2015 UTC