Troubleshooting - manual deploy and .env files

My deployments to a shared dev environment works well. Doing so to a staging environment is having more issues. The security on that environment is much different that still working through missing pieces for deploy. I cannot run capistrano to it or composer commands on it at the moment.

While I’m working those issues out, I’m trying to replicate the steps / setup manually for an initial release.

  1. Created a base path /var/www/ with shared, current and releases folders inside
  2. Made symlink from /var/www/html to point to /var/www/
  3. Put .env into /var/www/
  4. Created a release/2014initial/ folder with a full copy of site from dev
  5. Made symlink from /var/www/ to /var/www/
  6. Blank DB

I’m getting 500 errors. In the httpd/error_log I get a message that PHP Fatal error: Uncaught exception ‘RuntimeException’ with message 'Required ENV vars missing: ‘DB_NAME’, ‘DB_USER’, ‘DB_PASSWORD’, ‘WP_

Other things I’ve confirmed / ruled out:

  • The config/application.php calls to dirname(dirname(FILE)); does map to the release sub-folder.
  • Even putting .env temporarily into the release does not get it picked up.

Any suggestions on what I should be looking at or missing in setup?

PHP version?

I know you mentioned manually putting the .env file in the release, but before did you do any symlinking for the shared directory?

Basically for each release, Capistrano will also symlink anything in linked_dirs and linked_files from the shared/ dir to the latest release dir.

PHP 5.3.3

My deploy script has :linked_dirs to map uploads that I replicated. It also has one :linked_files for .env that I have also since posting tried doing from release/[releaseid]/.env to shared/.env that hasn’t had an impact.

Strange with that error because Dotenv will throw a separate error if the .env file can’t be loaded or doesn’t exist. You could try just throwing some debugging code right in the Dotenv src under vendor/ to see what’s going on. Could also be a web server configuration issue I guess, to test that you could just run php -f wp-config.php you’ll probably get some WP errors at some point, but you can isolate the Dotenv part at least.