开发者

What does it mean at the top a .cgi file "#!/usr/bin/env php" versus "#!/usr/bin/php"?

开发者 https://www.devze.com 2023-01-09 04:25 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消