I was going to add a shebang line to a php script
#!/bin/env php
but I was looking around and people don’t seem to be doing this.
- http://github.com/zurb/foundation/blob/master/marketing/about.php
- http://github.com/EllisLab/CodeIgniter/blob/develop/system/libraries/Cart.php
- http://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php
Is it “inappropriate” or against some rule to shebang a php file?
Usually hashbangs are only added when the PHP script is intended to be run from the command line, where it is useful. It is not typically useful to run PHP scripts designed for the web on the command line, and as such, people do not add hashbangs to them.
Also, I believe that in non-CLI PHP environments, PHP will echo the hashbang.