Welcome Guest, Not a member yet? Register   Sign In
Dreamhost config help needed
#1

[eluser]MrTacoz[/eluser]
Hi Folks,

I need some help getting my CI-based site working on Dreamhost.

I've hunted around on these forums and the wiki and at Dreamhost, and I can't figure out what is going on. If you have ideas on how to better debug what my problem is please let me know.
For those of you on Dreamhost, do you have specific config that works for you that you could recommend--please let me know which option documented here ( http://codeigniter.com/wiki/Dreamhost_.htaccess/ ) worked for you, or please let me know, if you've ended up using a different solution, what is that solution.

So here's what I've tried:

On my staging server (a Mac with apache 2.2.6 & php 5.2.4) my site works perfectly.
The CodeIgniter site is at the root of the website. i.e. system is in mysite.com/system

After uploading to Dreamhost, the site does not work correctly.

I have verified that the Dreamhost server is configured to use php 5 (5.2.3).

I tried both solution 1 & solution 2 on this page: http://codeigniter.com/wiki/Dreamhost_.htaccess/
And my main page (index.php) loads correctly, but any page provided by a different controller class (e.g. mysite.com/Login ) returns a CI 404.

If I remove the .htaccess altogether and try mysite.com/index.php/Login I also get a CI 404 error.

I've enabled logging of all messages in CI (e.g. $config['log_threshold'] = 4; in config.php) and have tailed the CI log and apache log while trying to load the pages, and I don't see any useful info.

As a sanity check, If I change my default route to "Login" (just to test that the default view for Login can actually be loaded), I do get the login page, so it looks like to freaky URL handling issue.

I've tried the suggestions to use $config['index_page'] = "index.php?"; from the troubleshooting guide: http://www.ellislab.com/codeigniter/user...oting.html

I've also read through many posts on this forum with people offering suggestions and have not made any progress.

Can anyone think of any way to get to the bottom of this issue?

Are there any useful points to add some debug logging to get more insight into why this is not working correctly?
#2

[eluser]Chris Newton[/eluser]
I'm running CI on several Dreamhost servers and don't have any special setup to get them to run properly. When I added a site at first I didn't have PHP 5 running and I had to run in query string mode until I figured that fact out, but after I switched to PHP 5 it ran just fine. From your notes it looks like running query strings isn't helping you either, and you're running PHP 5, so I dont' see any major gotchas. I'm running extra web security, not running fastcgi...

This is my config file, FWIW...

Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

$config['base_url']    = "http://mysite.com/";
$config['index_page'] = "index.php";
$config['uri_protocol']    = "AUTO";
$config['url_suffix'] = "";
$config['language']    = "english";
$config['charset'] = "UTF-8";
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['cache_path'] = '';
$config['encryption_key'] = "";
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";
$config['global_xss_filtering'] = FALSE;
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
?>
#3

[eluser]MrTacoz[/eluser]
Hi Mahuti,

Thanks for the reply. I tried using your exact config (I updated the base_url) and still no luck.

Regarding making sure that the server is running PHP5, did you do anything more that simply select php5 on the control panel for the site?

I've done that, and when checking the config (by loading a phpinfo.php file containing "<?php phpinfo(); ?>", at the top of the page, I see "PHP Version 5.2.3" but in the _SERVER config near the bottom of the page, I see this (indicating PHP 4.4.7): : _SERVER["SERVER_SOFTWARE"] Apache/2.0.54 (Unix) PHP/4.4.7 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2

Do you see the same thing, or does your server config actually show PHP/5.2.3?

Also, do you have any custom php.ini file that you are using?

Many thanks for any extra info you or anyone else might be able to provide to help shed light on what is going wrong.
#4

[eluser]Chris Newton[/eluser]
No custom PHP.ini file... in fact, I didn't think that Dreamhost even supported a custom PHP.ini file. Used to, I know they didn't, but it's been a few years since I checked. I think you could IF you were running your own build of PHP on your server (something that I never got around to doing)


ANYWAY...

server_software on my 5.2.3 unit; Apache/2.0.54 (Unix) PHP/4.4.7 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2

And I didn't do anything other than bump it up from 4.xx to 5.xx in the CP. Before I did that though, the query strings were working, so I knew it was just a configuration issue. In your case, even that's not working, so you have some problems.

At a minimum, I would suggest re-upping everything again to make sure that there wasn't a file transfer screw up. I like to start with the easy solutions first, personally. I can't tell you how many times over the years a foobarred upload caused me tons of headaches. You might try putting a default install of CI up there somewhere as well, just to make sure that it's not anything with your code (even though it's working locally)

Also, I don't know what they're supposed to be set at, but my folder perms on my application, controller, etc folders are set at 755.
#5

[eluser]MrTacoz[/eluser]
Hmmm. I tried a default CI install by tarring all the files and uploading the tar then expanding--still doesn't work. Same symptoms, though, the default route works, but if you add another controller and try to load that you get a CI 404.

Does anyone have any idea what would be a good way to diagnose where this/I am going wrong? If I knew the guts if CI better, I'd start looking at the code that maps the URL to the class+method, and add some logging. If someone else has gone down a similar path, please send me some tips about where to look. Until then, I'll start digging.
#6

[eluser]MrTacoz[/eluser]
O.K., it looks like I have found the issue and a fix.

SUMMARY: The first letter of classes should NOT be caitalized in URLs.

DETAILS:
I had been capitalizing the first letter of the class names in the URLs (e.g. mysite.com/Login ) . This worked on my staging server, but not on the Dreamhost server.
By going through and changing all class names to start with lowercase letters (e.g. mysite.com/login ) then the entire site works correctly on both my staging server and on the Dreamhost server. The form of the URLs for controllers IS explained in the documentation for controllers (http://ellislab.com/codeigniter/user-gui...llers.html ). I made a mistake of capitalizing the first letter of the class names in the URLs when I first created the site, and because it worked on my staging server I did not catch it until uploading to the Dreamhost server. Doh!
#7

[eluser]Chris Newton[/eluser]
Even though it's slower, I almost always work on my dev server rather than locally. Saves me transition headaches in the end.




Theme © iAndrew 2016 - Forum software by © MyBB