PHP Script #!/usr/bin/env php notation

Source: Internet
Author: User
Tags php script

The first line of the scripting language is to point out that you want the code in your file to run it with what executable program.

For example, the first line of the PHP script can be written in the following formats

#!/usr/bin/php#!/usr/bin/env php#!/usr/bin/env-s-p/usr/local/bin:/usr/bin php#!/usr/bin/env-s-p/usr/local/bin:/ Usr/bin:${path} PHP

#!/usr/bin/env the benefits of PHP notation

The main purpose of this writing is to make your program applicable on different systems.

Whether your PHP is in/usr/bin/php or/usr/local/bin/php

#!/usr/bin/env PHP will automatically look for PHP in the current user path variable to execute.

Plus-P parameter use to specify some directories to find PHP this program

#!/usr/bin/env-s-p/usr/local/bin:/usr/bin PHP's role is to find PHP in the/usr/local/bin and/usr/bin directories.

To make the program more extensible, you can write the following code:

#!/usr/bin/env-s-p/usr/local/bin:/usr/bin:${path} php (no spaces between-s-p)

It will also look in the directory defined in the path variable, in addition to the two directory searches.

#!/usr/bin/php written #!/usr/bin/env PHP would be better, of course #!/usr/bin/env-s-p/usr/local/bin:/usr/bin:${path} PHP

The general use of #!/usr/bin/env PHP This writing can be compatible with most servers.

PHP Script #!/usr/bin/env php notation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.