4

I've been using Focus Lab's Master Config for most of this year and have never run into this issue before.

So here's what's happening, going to the domain (example: mysite.com/index.php or mysite.com) brings up a 500 internal server error. Going to mysite.com/admin.php does too. The .htaccess file is blank for the time being, but will eventually contain rules for removing index.php, expires, etc.

Going to www.mysite.com/index.php, www.mysite.com or www.mysite.com/admin.php all work. Going to subpages with www in front also seems to work fine.

My config.env.php file looks a little like this: http://pastie.org/5461257

If I change the first case to include the www, I get the 500 internal server error, AND the site shows correctly, including subpages.

If I throw the following into .htaccess (www to no www redirect) and keep the first case statement in config.env.php to include the www, the site works. If I change the case statement to just be mysite.com, the site does not work.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Then, if I force www in .htaccess and keep www in config.env.php, the site doesn't work. If leave off www in config.env.php, the site works.

For now, just to get the site up and running, I've forced removal of www, left www in the config.env.php file, and added other rules to .htaccess (such as removing index.php, expires, etc.) and it's working fine.

I'm wondering if anyone has any insight as to why something like this would happen? I don't know that much about servers, but something tells me there's something funky with this client's host.

2
  • When you are using www.domain.com and the case in env-config is www.domain.com do you get a error500 AND the site works? The internal server error should force a shutdown? Dec 1, 2012 at 23:46
  • I may have confused myself there. Will need to go back and look. :)
    – A Herrera
    Dec 2, 2012 at 0:53

2 Answers 2

7

In cases like these it's likely that there is something unique about how the host sets certain environment variables within PHP.

A few questions:

  • Who is the host?
  • Do you have access to server error logs?
  • If so, what's in the error log?

If you have a 500 error you should have a log of the reason somewhere on the server. If there isn't, as your host where you can access that information. That will really help drill down to the source of the problem.

4
  • The host is some random company that I've never even heard of. We have limited access to server error logs via cPanel but nothing really stuck out (mostly just a bunch of 404s). Will definitely ask though and hope for a halfway decent response. :/
    – A Herrera
    Dec 1, 2012 at 21:00
  • Also... My fault for not setting up the client with a better host in the first place. I don't even know how they ended up with this host. We're working on regaining control of their domain so we can switch them. Thanks for the tips though, much appreciated!
    – A Herrera
    Dec 1, 2012 at 21:01
  • Marked this as the answer - it was definitely a host issue. We were finally able to switch them. Thanks!
    – A Herrera
    Jan 10, 2013 at 4:21
  • Great! Glad to help! Jan 10, 2013 at 15:07
4

In your index.php & admin.php are you pointing your system path to the correct spot?

I keep my system above root:

$system_path = '../system';

On a related note, can you turn on debugging in your index/admin files?

Earlier this week I had the same issue until I enabled debugging and got:

Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php

Then I promptly fixed the path and it worked.

2
  • Path is set correctly; site is actually running.
    – A Herrera
    Dec 1, 2012 at 20:58
  • Hey @Paulo, I am getting the same error "Your system folder path does not appear to be set correctly." however I have tried both the variations listed in the docs with no success eg. $system_path = '../site1.com.au/system/'; and $system_path = 'site1.com.au/system'; Any thoughts?
    – Dan
    Mar 11, 2013 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.