<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 23 May 2013 22:50:49 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Sean Coates' Blog: Use `env`]]></title>
      <guid>http://www.phpdeveloper.org/news/17984</guid>
      <link>http://www.phpdeveloper.org/news/17984</link>
      <description><![CDATA[<p>
<i>Sean Coates</i> has posted a reminder for PHP developers (and really anyone executing command-line scripts) to <a href="http://seancoates.com/blogs/use-env">use "env"</a> instead of hard-coding the path to the PHP interpreter.
</p>
<blockquote>
These [support] scripts often run PHP in Gimme Bar land, and we make extensive use of the shebang syntax that uses common Unix practice of putting #!/path/to/interpreter at the beginning of our command-line code. Clearly, this is nothing special -lots of people do exactly this same thing with PHP scripts. One thing I have noticed, though, is that many developers of PHP scripts are not aware of the common Unix(y) environment helper, env.
</blockquote>
<p>
The "env" alias makes use of your currently defined include path to track down a PHP binary to use to execute the script. Since there's only a "best practices" approach to places to put PHP on a server, the "env" usage makes your script more portable and it's one less thing to remember to change.
</p>
<blockquote>
If you distribute a PHP application that has command-line scripts and shebang lines, I encourage you to adopt the practice of making your shebang line "#!/usr/bin/env php". Note that this doesn't just apply to PHP of course, but I've seen a definite lack of env in the PHP world.
</blockquote>]]></description>
      <pubDate>Mon, 21 May 2012 11:58:34 -0500</pubDate>
    </item>
  </channel>
</rss>
