title: Setup Yii2 Advanced on Heroku
body: <p>I am needing some help setting up a Yii2 Advanced Application on Heroku. I have already installed Yii locally using Composer, following their guide exactly: <a href="http://www.yiiframework.com/doc-2.0/guide-tutorial-advanced-app.html" rel="noreferrer">http://www.yiiframework.com/doc-2.0/guide-tutorial-advanced-app.html</a></p>
  
  <p>My website works as it should locally, with frontend and backend:</p>
  
  <pre><code>http://localhost/yii2app/frontend/web/
  http://localhost/yii2app/backend/web/
  </code></pre>
  
  <p>When I push it and run it on Heroku, I get errors complaining that some files are not found. What is weird, is with a bash terminal to my Heroku app, I can verify that the file is in fact there! Is Heroku not liking the '../../' to change directory?</p>
  
  <pre><code>PHP Fatal error:  require(): Failed opening required '/app/frontend/web/../../common/config/main-local.php'  
  include_path='.:/app/.heroku/php/lib/php') in /app/frontend/web/index.php on line 12
  </code></pre>
  
  <p>In 'frontend/web/index.php' is Yii's stock code (line 12 is main-local.php):</p>
  
  <pre><code>$config = yii\helpers\ArrayHelper::merge(
  require(__DIR__ . '/../../common/config/main.php'),
  require(__DIR__ . '/../../common/config/main-local.php'),
  require(__DIR__ . '/../config/main.php'),
  require(__DIR__ . '/../config/main-local.php')
  );
  </code></pre>
  
  <p>If it had to do with the '../../' to change directory, then I would think the first require would have an error (for the main.php entry).</p>
  
  <p>What am I missing to get Yii2 advanced running on Heroku?</p>
  
  <p><strong>UPDATE</strong> - I created a new Yii2 basic app. Should work and be simple, so I thought. Apparently even the basic app does not run on Heroku. There MUST be something left out from the docs, somewhere... Used composer to install Yii2 basic, put it under git, pushed it to a new heroku stack. Went to check out my app on heroku, adding /web/index.php to the end of the url.</p>
  
  <pre><code>ReflectionException
  Class yii\debug\Module does not exist
  </code></pre>
  
  <p>I then put index.php in the root directory containing phpinfo(). I can confirm I get a phpinfo report. So php is running, it reports PHP 5.6.5.</p>
  
  <p>Seems like Yii2 and Heroku do not play well without some magical (and un-documented) tricks. I have searched, and searched, and searched, and I can't find anything about this. I can't possibly be the only one trying to get a Yii app onto Heroku.</p>
  
  <p>So I tried CloudControl. I deployed my stock Yii2 basic app to cloudcontrol, again I get a phpinfo report on the root index.php. Navigate to /web/index.php and get errors:</p>
  
  <pre><code>Invalid Parameter – yii\base\InvalidParamException
  The file or directory to be published does not exist: /srv/www/code/vendor/bower/jquery/dist
  </code></pre>
  
  <p>What gives! I can run this locally just fine. When I push it to a cloud based host (Heroku or CloudControl) it fails! I figured the yiibasic app would be better to at least get it running for PoC, but Yii out of the box, will not run on either of those services. There is <em>something</em> not mentioned that I am missing.</p>