title: Run console php script by nodejs on heroku hosting
body: <p>I have a nodejs application runned on heroku. 
  I have to run console PHP script in it.
  I want to execute the script by child process - <a href="http://nodejs.org/api/child_process.html" rel="nofollow">http://nodejs.org/api/child_process.html</a>.</p>
  
  <p>My question is - how can i enable both nodejs and php interpreter in heroku hosting?</p>
  
  <p>this is index.js file of my application  (simplified)</p>
  
  <pre><code>var http = require('http'),
    exec = require('child_process').exec;
  
  http.createServer(function (req, res) {
  
  
    exec('php script.php',
      function (error, stdout, stderr) {
        if(error){
          throw error;
        } else {
          res.writeHead(200, {'Content-Type': 'text/plain'});
          res.end(stdout);
        }
      });
  
  }).listen(process.env.PORT || 3000);
  </code></pre>
  
  <p>this is script.php file</p>
  
  <pre><code>&lt;?php
  echo "Hello, world!";
  </code></pre>
  
  <p>When i try to start my application, i has this response in logs</p>
  
  <pre><code>Sep 23 06:44:48 blooming-woodland-9158 app/web.1:  Error: Command failed: /bin/sh: php: not found 
  Sep 23 06:44:48 blooming-woodland-9158 app/web.1:      at ChildProcess.exithandler (child_process.js:648:15) 
  Sep 23 06:44:48 blooming-woodland-9158 app/web.1:      at ChildProcess.emit (events.js:98:17) 
  Sep 23 06:44:48 blooming-woodland-9158 app/web.1:      at maybeClose (child_process.js:756:16) 
  Sep 23 06:44:48 blooming-woodland-9158 app/web.1:      at Socket.&lt;anonymous&gt; (child_process.js:969:11) 
  Sep 23 06:44:48 blooming-woodland-9158 app/web.1:      at Socket.emit (events.js:95:17) 
  Sep 23 06:44:48 blooming-woodland-9158 app/web.1:      at Pipe.close (net.js:465:12) 
  </code></pre>
  
  <p>so it looks like it do not have the PHP binary installed</p>
  
  <p>UPD: they have the buildpack for php
  <a href="https://github.com/heroku/heroku-buildpack-php" rel="nofollow">https://github.com/heroku/heroku-buildpack-php</a>
  i'll try to use it and share the result here</p>
  
  <p>UPD1: buildpack do not allows to start nodejs for it
  I decided to build php binary like described here and ship it with my project - probably i can build the PHP binary and ship it with my project - <a href="https://stackoverflow.com/questions/24173906/compile-php-into-static-binary">Compile PHP into Static Binary</a> </p>