title: How can I install composer via PHP script?
body: <p>I am trying to create an automatic deployment for a Symfony 2 project. Part of this deployment process should be the download and installation of Composer (<a href="http://getcomposer.org" rel="nofollow">http://getcomposer.org</a>).</p>
  
  <p>The instructions for installing Composer differ between Windows and Linux but this command seems to work on both systems:
  <code>php -r "readfile('https://getcomposer.org/installer');" | php</code></p>
  
  <p>Basically, what this does is download a PHP script and then run it to install composer. I wanted to create my own PHP script because I wanted to avoid creating different shell scripts (.bat and .sh) for different operating systems.</p>
  
  <p>My very simple PHP script looks like this:</p>
  
  <pre><code>&lt;?php
  $installer = readfile('https://getcomposer.org/installer');
  eval($installer);
  </code></pre>
  
  <p>However, when calling this script I always get an error:</p>
  
  <pre>PHP Parse error:  syntax error, unexpected end of file in C:\Users\chris\randomproject\getcomposer.php(4) : eval()'d code on line 1
  
  Parse error: syntax error, unexpected end of file in C:\Users\chris\randomproject\getcomposer.php(4) : eval()'d code on line 1</pre>
  
  <p>It seems the script delivered by the composer server can not be executed via eval().</p>
  
  <p>What other options do I have?</p>