• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Resolved] Differences in localhost vs remote hosting

#1
[eluser]Will Cheung[/eluser]
Hi guys,

Currently trying to deploy (read as "copy over"!) a CI application to my hosted space. Currently, the system works fine on the dev machine as localhost, but as soon as I put the thing onto the deployment environment, I'm getting 404s (the CI 404s, not the native ones).

I have adjusted the config (played with all URI config types), database and route files to ensure that they all match to the corresponding deployment information, I've checked for case sensitivity (in filenames, classnames and functions). Furthermore, I've also made sure that the file access permissions were correct and that there weren't any htaccess files floating around...

...However, I'm still getting the strange 404 issue. In addition, I keyed in the URL to one of the functions in a controller and that works perfectly, yet landing on the root doesn't seem to trigger the default controller.

Any ideas guys?


With thanks,


Will

#2
[eluser]n0xie[/eluser]
If you try to access the 'homepage' controller directly via the url, does it show up?

#3
[eluser]Will Cheung[/eluser]
Strangely, if I access it via the full URL and controller, it appears.

So www.mywebsite.com gives me the CodeIgniter 404, whereas www.mywebsite.com/index.php/MyController works - this is frustrating given that previously, it had worked properly.

Not the only problem with the code at the moment, given that I had previously suffered from case sensitivity issues, which I am rechecking Sad

#4
[eluser]n0xie[/eluser]
In your config/routes.php are you sure this is correct?
Code:
$route['default_controller']  = "mycontroller";

#5
[eluser]Will Cheung[/eluser]
Yep unfortunately - triple checked that the first time round - changed the case around on it, checked the contents of the controller itself and can't see anything strange

#6
[eluser]WildPhoenix[/eluser]
.htaccess file? Did you have one set up localy? If you did, did you copy this up??

#7
[eluser]jedd[/eluser]
Hi Will,

Remember that we get quite a few people posting messages like yours here, and after several hours of frantic activity it's wrapped up by a 'oh, there *was* an .htaccess file there that I'd forgotten about'.

Hence you're going to find a few repeat questions .. not because we don't trust you, but because we don't trust anyone posting these kinds of messages. It's a simple case of statistics, really. Not having access to your keyboard and screen just makes the process slightly more frustrating, of course, as there's obviously no simply heuristics that can be shared on how to quickly resolve these things (if there were, they'd already be published).

And remember, .htaccess files inherit .. so you have to search up to your web root, not just the directory you're publishing your site to. Also, if you have removed the index.php requirement from your URL, then you almost definitely need an .htaccess file in play.

If you've got a public host - share the URL with us. Sometimes it's enlightening. Usually not, though, with a 404 like this .. but you never know.

Have you looked at your logs? The most interesting ones here would be the apache access and error logs - you can tail -f them if your remote box is a real operating system and you have real access to it. It'll provide good feedback on what the web server is trying to load from the file system (and what it can't). You can bump up error logging in your apache config, though it's usually good enough by default for these kinds of problems. You can also check the CI logging feature, though I've usually not found that one very helpful.

#8
[eluser]brianw1975[/eluser]
Yeah, I know, I keep saying it over and over again, (but it really is so easy to forget) make sure your Apache host config file has AllowOverride All set for your "public_html" web directory.

http://httpd.apache.org/docs/1.3/mod/cor...owoverride

Another thing to check is to make sure that the mod_rewrite module is being loaded by Apache -- if you have the Ifmodule check in your .htaccess (like below) remove it and then see if you get a 500 error (in the browser) - this should verify that mod_rewrite isn't being loaded by Apache.

Code:
<IfModule mod_rewrite.c>
#rewrite rules in here
</IfModule>

#9
[eluser]Will Cheung[/eluser]
Thanks for the replies Bubblz, jedd and brianw1975.

Appreciate the fact that questions seem to be re-asked here.

In response to .htaccess observations - I wasn't aware of the fact that .htaccess files inherited from the root up, but at the same time, what I found really strange was that there hadn't been any .htaccess file changes from when I had deployed the app previously and it worked fine (which led me to believe it was a CI error on my behalf).

I had put the code on a hosted server, but its not public at the moment so apologies for not being able to share an example with you guys. I'm not much of an expert with administering Apache, but I do know that my hosting provider has undergone some server changes recently so I'll investigate.

... will pearoast when I finally get to the bottom of it!

#10
[eluser]Will Cheung[/eluser]
Hi again guys... just to keep my promise...

... turns out that my hosting company managed to upgrade to PHP 5.2.9 and I didn't realise - then I came across this after doing a small amount of digging:

http://codeigniter.com/bug_tracker/bug/7126/

URI compatibility issues indeed...

So, after a quick export from the SVN and a quick file transplant later, the stuff appears to be reworking again. Of course, all that remains now is that I do repairs on my previous "repairs" Wink

Appreciate those who contributed again, ta.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.