|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37352 cli do not parse any arguments the first line
Submitted: 2006-05-07 19:00 UTC Modified: 2006-09-01 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: eddi at ai000 dot de Assigned:
Status: No Feedback Package: CGI/CLI related
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
30 + 7 = ?
Subscribe to this entry?

 [2006-05-07 19:00 UTC] eddi at ai000 dot de
1.) It is not really a bug because it is not provided in php_cli.c. It is a feature request. PHP should suppord arguments in the first line of a script.

#!/opt/php/php -c /other/config.ini -z /zend/



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-07 19:07 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

RTFM of your shell system....only one argument is supported in hash bang lines
 [2006-05-07 19:17 UTC] eddi at ai000 dot de
Please have look in the php_cli.c. The function cli_seek_file_begin reads already the first line. Why it seems to you PHP could not support arguments form the first line like Perl?
 [2006-05-07 21:08 UTC]
Parsing of the shebang line is a kernel task. Linux supports one argument, FreeBSD parses them the way you would like. This is not a bug in PHP.
 [2006-05-08 00:13 UTC] eddi at ai000 dot de
May be it is difficult to understand me without well formed english. But Firstly nobody scould you "it is a bug". Edink, you are scound one telling me that. Please read this lines and do not forget, here is a human being too, who said "is a feature request".

Secondly it is an undiscussed fact, perl or python use the arguments from the first line reading itself.

Thirdly perl and python do so on linux and other systems like Mac OS too. So what is the problem? All I solicit you is to dealing with arguments from the first line.

Sixthly there are a serious problem with security for written daemons based on PHP. Interpreter starts and include  the master-ini and each php[-cli].ini in PWD. May be the last make the daemon unsecure. If I could define a config file fixed in the daemon script, security is in my hand exclusivly.

Seventhly there are no way defining discriminative config files for all problems, that I would like to handle with PHP when I try to start processes by script file directly. Or I have to change the directory each time and need a script starting all written daemons too. Exactly that (and changing my OS) suggest your answers (partially indirect).

Eighthly it is an undiscussed fact, at start up PHP reads the first line yet. But the function cli_seek_file_begin() (from php_cli.c) handle the first line peculiarly. Example: "#!php\rthis text is in the first line but still displayed\n<?php /* ... */ ?>"

You may right at the point. Yes it is a handicap of the operating system. Nonetheless we still need it. Please modifie cli_seek_file_begin() it will parse arguments.
 [2006-05-08 22:37 UTC] eddi at ai000 dot de
I have a patch for you: 

new php_cli.c:

I do it as good as I can. Sorry C is not my favorite language :)
 [2006-08-24 14:52 UTC]
Both links do not work anymore.
 [2006-09-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu May 26 01:03:41 2022 UTC