php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70125 PHP Shebang
Submitted: 2015-07-24 07:47 UTC Modified: 2017-08-05 04:50 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: tuxy at vmail dot me Assigned:
Status: Suspended Package: Scripting Engine problem
PHP Version: 5.6.11 OS: Arch Linux
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tuxy at vmail dot me
New email:
PHP Version: OS:

 

 [2015-07-24 07:47 UTC] tuxy at vmail dot me
Description:
------------
Feature request to remove the need to use "<?php" when using shebang "#!/usr/bin/php"

Note this is only for terminal php scripts anyway, there is no need to use "<?php" with that.

Test script:
---------------
Example, this is how its done now:

#!/usr/bin/php
<?php
//code

Request to have this instead:

#!/usr/bin/php
//code


Expected result:
----------------
n/a

Actual result:
--------------
n/a

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-24 08:18 UTC] stas@php.net
-Package: PHP Language Specification +Package: Scripting Engine problem
 [2015-07-29 00:27 UTC] cmb@php.net
To me it doesn't make sense to introduce a special syntax for
scripts starting with a shebang line. Either there'll be the
possibility to have PHP code only files, or not. Actually, I'm
fine with the latter, as that also can make sense for CLI scripts.
 [2015-07-30 05:49 UTC] yohgaki@php.net
There are a few RFCs related to this topic.

https://wiki.php.net/rfc/phpp
https://wiki.php.net/rfc/nophptags
https://wiki.php.net/rfc/script_only_include

There may be others.
 [2015-07-30 06:06 UTC] tuxy at vmail dot me
@ cmb@php.net, It may make sense to you but no one else. Most other languages have proper shebang in them. Why not have the same for PHP when script is intented to only be executed and used in shell/terminal. Remember I'm talking about the shebang for CLI scripts and NOT web.

@ yohgaki@php.net, None of this related to this shebang post.

-- Off Subject --

Please remove my email from this posts, or at least leave only "tuxy" and not full name!!
 [2015-12-08 22:36 UTC] yohgaki@php.net
@tuxy

We cannot remove email. Please use mail address that you wouldn't mind next time.

Anyway, what you are proposing breaks compatibility. "PHP executes script in embedded mode always"

-------------
#!/use/bin/php

Hello! Current date is <?php echo date('Y/m/d'); ?> !
-------------

This script is perfectly valid with current PHP. We need some RFC that "allows to start PHP with non-embedded mode" as I mentioned earlier. e.g.

-------------
#!/use/bin/php -X
// Non-embedded mode, so this code is syntax error.
Hello! Current date is <?php echo date('Y/m/d'); ?> !
-------------
 [2017-08-05 04:50 UTC] stas@php.net
-Status: Open +Status: Suspended
 [2017-08-05 04:50 UTC] stas@php.net
Thank you for your interest in PHP and for submitting a feature request. Please be aware that due to the magnitude of change this request requires, it would be necessary to discuss it on PHP Internals list (internals@lists.php.net) as an RFC. Please read the guide about creating RFCs here:
https://wiki.php.net/rfc/howto
If you haven't had experience with writing RFCs before, it is advised to seek guidance on the Internals list (http://php.net/mailing-lists.php) and/or solicit help from one of the experienced developers. 

Please to not consider this comment as a negative view on the merits of your proposal - every proposal which requires changes of certain magnitude, even the very successful and widely supported ones, must be done through the RFC process. This helps make the process predictable, transparent and accessible to all developers.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 06:01:30 2024 UTC