I usually see
#!/usr/bin/php
or
#!/开发者_Python百科usr/bin/perl
at the top of a CGI file. How is a
#!/usr/bin/env php
or
#!/usr/bin/env perl
different from the first 2 lines? They work as well.
Shebangs, the #!/usr/bin/sh
part of the script, require an absolute path to the interpreter. Because there is no standard path for some interpreters some scripts use #!/usr/bin/env interpreter
to launch the correct interpreter.
This is documented on the Wikipedia page for env. It basically runs the command without modifying existing environment variables.
精彩评论