CodeIgniter vs Godaddy Problems

Tuesday, 11th December, 2007 at 1:57 am (CodeIgniter, Informative, Technical) (, , , , )

Hello every one. I’ve been planning for this post long. But couldn’t manage time. This is about a problem i have faced during my freelance work on mid August for a client in Bosnia. My web application was built with CI and was working fine in local as well as remote server. But was causing problem on clients Godaddy server.
Problems were:

  1. It was giving problem ‘404 Page Not Found’ when requesting default route.
  2. Request with full url with controller was giving ‘No input file specified’. Which was solved by putting ‘index.php?’ in the config file. But i want to remove the index.php from the url. Have tried all the .htaccess settings suggested in the forum.
  3. All the database transaction gives a error like below:

A PHP Error was encountered

Severity: Warning

Message: mysql_real_escape_string() expects parameter 2 to be resource, boolean given

Filename: mysql/mysql_driver.php

Line Number: 227

After that i tried some suggestions from this user guide page. Which actually solved my problem No. 1 with changes in config.php like below:

$config['uri_protocol'] = "QUERY_STRING";
and
$config['uri_protocol'] = "ORIG_PATH_INFO";

Other settings were either failing or was giving me the default controller for all the url i request for. But my problem No 2 and 3 was still on loose.
Then again i’ve started to investigate and found a problem of database connection. Actually i was so sure that DB connection settings problem will show me an error on initial stage that i’ve never double checked the DB settings. But for some weired reason, CI doesn’t show any error on DB connection problem over Godaddy. So beware of it.

So after rechecking the DB settings my problem No 3 was gone. Now lets see the .htaccess settings for problem No 3 which works under Godaddy server:

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

Additional to the solutions above, also try to re ftping your scripts. Just in case. Also some others suggested me to avoid this host to save time :-) .
Whole thing was done with suggestions and help of great CodeIgniter forum. You can get further help and old discussions over there.
You can also visit my clients site here. Which (thanks God) is running smoothly ever since.
Thank you all.

17 Comments

  1. ImageSmith said,

    great resource marahman.
    fyi, i have run into similar probs on a server here in aust running php5. turns out that the phpinstall is funning as cgi. need to do similar fixes to make ci work.

    cu in ci

  2. Djordje said,

    Very helpful

  3. Derek Allard said,

    Fantastic! Thanks, this will help a user I have on Bamboo. Sincerely appreciate you taking the time to write this up!

  4. HumaN said,

    Thanks everybody.
    My pleasure.. :D

  5. sam said,

    Good info there,
    Just to update on problem number 3 which shows mysql error using codeIgniter, the new user should be created with password. Using existing or default user privileges doesn’t work many times.

  6. HumaN said,

    Thanks Sam.
    Appreciate your update.
    Hope that helps other as well.
    ;-)

  7. Jon said,

    Just so you’re aware, GoDaddy has something they call an “htaccess cache” that gets refreshed every hour.

    I was frantically updating/deleting/changing my htaccess file on their server trying to get rid of the ‘index.php?’ without seeing any sign of hope. When I sat back and just waited for an hour, everything suddenly worked correctly.

  8. HumaN said,

    Thanks for the update Jon,
    I think this could be the reason for many confusions..

    good days… :D

  9. kamal somani said,

    all working fine with “/index.php?/” , but still unable to configure it excluding index.php, its gives a blank page..

    i have tried changing the config file as below ….

    $config['uri_protocol'] = “AUTO”; (have tried all other options also)

    $config['index_page'] = “index.php?”; (also tried making it null ” )

    but none worked..

    My godaddy hosting has many domians as sub-folders on the root .. and each domain is directed to its own directory…

    plz help. me to remove the index.php from the url..

    thanks

  10. HumaN said,

    Kamal,
    please see Jon’s comment above on, “GoDaddy has something they call an “htaccess cache” that gets refreshed every hour.”

    I think this is causing the problem you are facing at the moment.

    take care… ;-)

  11. Mete Ercan Pakdil said,

    I tried .htaccess that mentioned above but it didn’t work. After i added RewriteBase / , it works fine!

  12. Chris Davis said,

    Holy Cow,

    Thanks so much for the help on getting rid of index.php? in the url string on a godaddy server. I had it working on my other hosting plan but one of my clients using godaddy I could not get it to work until I tried your .htaccess script above and now it works great!

    thanks again!

    Chris

  13. Kai Meng Wong (victorwkm) » Blog Archive » mod_rewrite said,

  14. Keagan Chisnall said,

    Thank you very much. Past two hours have been spent trying to solve this stupid problem, but it works 100% now ;)

    • HumaN said,

      Welcome Good to know it served your purpose. :)

  15. CodeIgniter on Godaddy Servers « Concept Execution said,

  16. harman said,

    gr8 work thanks a lot

Post a Comment