title: PHP Autoload is not called in CLI
body: <p>I have a code that is executing a php script in CLI using shell_exec</p>
  <p>because this script is requiring all sort of information that is usually loaded via Apache I have to load them manually.
  for example $_REQUIRE and $_SERVER.</p>
  <p>This is the command I am executing inside shell_exec</p>
  <p><code>php -B  &quot;\$_REQUEST =  array('script_path' =&gt; 'aaa/bbb.php', 'id' =&gt; '55', 'script_params' =&gt; '{\&quot;account_id\&quot;:\&quot;180000001384\&quot;,\&quot;days\&quot;:10}'); \$_SERVER['DOCUMENT_ROOT'] = '/vvv/www/sss/environment';  require_once('/vvv/www/sss/environment/vendor/autoload.php'); require_once('/vvv/www/sss/environment/services/readerWrapper.php');&quot; &gt; /dev/null 2&gt;/dev/null</code></p>
  <p>now I get an error that one of my classes is not found.</p>
  <p>that class is being loaded using nameSpace:</p>
  <pre><code>use path/ClassName;
  </code></pre>
  <p>my guess is that the autoload.php is not being executed properly.
  I also tried requiring directly:
  <code>&quot; require_once('&quot; . $_SERVER['DOCUMENT_ROOT'] . &quot;/vendor/composer/autoload_real.php'); &quot; .</code></p>
  <p>But it still doesnt work and I get the same error.</p>
  <p>what can I do what am I doing wrong ?
  thank you!</p>
  <p>Edit:
  I manage to confirm that the autoload is actually is being called. I can see that it is loading values into the $_GLOBALS array. the problem is that for some reason namespace is not being recognized in the CLI.</p>