php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: eddi at ai000 dot de
New email:
PHP Version: OS:

 

 [2006-05-07 19:00 UTC] eddi at ai000 dot de
Description:
------------
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/modul.so

Thanks.



Patches

Pull Requests

History

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

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] edink@php.net
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: 

diff:          http://www.ai000.de/PHP/37352.txt
new php_cli.c: http://www.ai000.de/PHP/php_cli.c.txt

I do it as good as I can. Sorry C is not my favorite language :)
 [2006-08-24 14:52 UTC] tony2001@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC