Hi there, I’m trying to get Grav deployed to Heroku, basically I just have the RTFM skeleton with different pages. I’m testing locally in WAMP and have it on GitHub. Heroku goes through the motions, says it’s deployed and gives a 500 error when attempting to view the page. Any ideas what i am missing?
My most recent build log is here,
A 500 error always means a problem with the web server configuration. Typically with Apache this means that something in the configuration is not supported in the current Apache setup. With Grav, there is an
.htaccess file which is automatically picked up by Apache to configure it.
So stands to reason that your server is not liking something in this file. Really the only Apache requirements is
mod_rewrite. So my guess is that Heroku is not installing this by default. Check this out:
Cheers, I’ll check that out as soon as I can and get back you. Thanks.
I’ve taken a look a the file, but can’t see anything obviously wrong, and the fact it works in WAMP and MAMP fine suggest that it should be okay. Heroku is picking the app up as PHP and using Apache automatically, but even when explicitly stated it makes no difference. Interestingly, I have seen what happens when .htaccess isn’t picked up, and it’s not 500 errors, the default page works fine but no others. So I’m not sure that is the issue, I’ve also compared my .htaccess file to the one here (https://github.com/martylouis/grav-heroku/blob/master/.htaccess) which according to the title and description is an attempt to get Grav working on Heroku, mine differed so I made it identical, still no joy.
I really still think this is because your Heroku setup is not installing or enabling mod_rewrite. How are you configuring apache during this install process?
When I first ran it locally without the mod__rewrite module installed, I got an error telling me to enable it. Now if I disable it locally, I just see some page data but no dependencies get loaded, like css / js etc. I don’t get a 500 error, I’ll keep looking into it to see if there’s anyway I can verify that mod__rewrite is enabled.
okay, i’m not sure i’m any closer to resolving this to be honest. I’ve been fiddling with many different techniques, what I can confirm though, is if i remove the .htaccess file, I can get to LICENSE.txt, if I put it in, I get a 403 error. So doesn’t that suggest that the rule is being applied to block access to it? Namely this line,
# Block access to specific files in the root folder RewriteRule ^(LICENSE.txt|composer.lock|composer.json|\.htaccess)$ error [F]
But that said, I still can’t see index.php, that returns a 500, if I try some random url like test.php (doesn’t exist), I get a 404 error as expected.
Do you have a URL of the site in question? How about some instructions on how I can try to replicate this myself?
Just too many moving parts to debug with your info alone.
Did you read the Heroku logs when you the 500 error? I got it running perfectly fine after installing the
mbstring PHP extension heroku had not enabled by default.