Trellis PHP error on production - while reading upstream

Hello,

Messing around with Trellis past few days, and have a question if anyone might care to answer.

I’ve done a handful of deploys to droplets using fresh clones (some today), and I always seem to come up with the same issue. Never any issues on my vagrant box.
In wp-admin it shows the error “ERROR: Template is missing.”, although the theme appears to be working fine, the loop of posts don’t show.

So I checked and sure enough I have this in my error.log (anonymized):

PHP message: PHP Warning:  include(): Failed opening '' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in
/srv/www/examplesite/releases/20150915004018/web/app/themes/my-theme/base.php on line 24" while reading upstream, client: myip, server: operationinnovate.com, request: "GET /blog/
HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-wordpress.sock:", host: "example.com"

Have made no changes to base.php.

In the nginx conf I noticed user is www-data so I tried a chown -r on those paths for the www-data user, but no luck.

Did I miss an important step to cause this?

That line points to here: https://github.com/roots/sage/blob/12fe0473683553f2adf7652076b198ce122c5cc1/base.php#L24

That’s the main template include so obviously something went wrong. Have you made other changes? Is it default Sage? Or could you try with a completely default version?

That’s the line where the Wrapper should be including the actual template according to the WP template hierarchy. Not sure why it shows as a blank string, I’ve never seen that personally.

I would check the theme folder and make sure the other template files are there in the root of the folder, at the very least index.php

1 Like

This is completely stock Trellis, Bedrock and Sage.

Thanks, you’re right it was the index.php file missing from the Sage folder. Not sure how it got excluded from the repo but, added it as an exception to gitignore and redeployed. I remember I also had to add !web/index.php as well to get the frontend to show up at all.

I’ve never had to do this. Have you added index.php to your gitignore file for some reason?

1 Like

I had a similar problem here where i was missing a file. Was a bit weird as i did the whole roots-example-project process step by step at least 10 times with the same result then.

1 Like

Same here @darjanpanic , followed the steps exactly so I was a little perplexed.
Obviously something was wrong, so after some digging I found the culprit. I’m using bitbucket and sourcetree for these, and at some point in the past index.php had gotten globally ignored. So, there’s the answer, check global ignore file in whatever version control you’re using, will bet a (metaphorical) dollar that it’s there.

My mind was too far into Trellis land to see the problem. Thanks a billion for the help guys, and all the work that you do. @kalenjohnson deserves to have his “unhelpful” tag updated :smile: