title: Calling node from a PHP script
body: <p>I'm trying to call a node script from a PHP script using <code>exec</code>:</p>
  
  <pre><code>$output = exec("/usr/bin/node /home/user/nodescript.js");
  </code></pre>
  
  <p>The nodescript.js being:</p>
  
  <pre><code>var Scraper = require('google-images-scraper');
  
  var keywords = process.argv[2];
  
  var scraper = new Scraper({
      keyword: keywords,
      rlimit: 10, // 10 p second
  });
  console.log("foo");
  scraper.list(10).then(function (res) {
      console.log("bar");
      console.log(res);
  });
  setTimeout(function () {
      process.exit(1);
  }, 20000)
  </code></pre>
  
  <p>But what I receive is the string "foo", and not the "bar". If I run the node script from command line, I do get "foo" and "bar". Somehow I don't receive any console output inside the function. What am I doing wrong?</p>