CodeIgniter vs Godaddy Problems

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.

Advertisements

26 thoughts on “CodeIgniter vs Godaddy Problems

  1. ImageSmith says:

    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. Derek Allard says:

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

  3. HumaN says:

    Thanks everybody.
    My pleasure.. 😀

  4. sam says:

    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.

  5. HumaN says:

    Thanks Sam.
    Appreciate your update.
    Hope that helps other as well.
    😉

  6. Jon says:

    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.

  7. HumaN says:

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

    good days… 😀

  8. kamal somani says:

    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

  9. HumaN says:

    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… 😉

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

  11. Chris Davis says:

    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

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

  13. harman says:

    gr8 work thanks a lot

  14. Pankaj says:

    Hi guys,

    If still there is any problem, have a look at this link, it will help you.
    http://pankajdangi.com/2010/04/no-input-file-specified-codeigniter/

    Thanks
    Pankaj

  15. prasanthanth says:

    I am very new in PHP & Linux machines. I am getting this “no input file specified error”. I am getting first page. But all other pages have problem. Can any one help me to trace it? I dont know where i need to put this .htaccess file.. and where i can find this .ini file etc… 😦

  16. HumaN says:

    check if putting $config[‘index_page’] = “index.php”;
    worked inside config.php

    if not, try renaming all the view files in small letters.

  17. prasanthanth says:

    thank you very much for reply. By default config files contains $config[‘index_page’] = “index.php”;. Class name & file name everything in small letter. 😦

    I think i have to something in ini file & htaccess. can you please help me to find that files? i dont know where it is located

  18. HumaN says:

    In that case, i think you should consult with google.
    usually .htaccess should be kept at root folder.

    Also ini should be located as php.ini If I am not wrong.

  19. ram says:

    hi to all,
    I have developed a project in php using codeIgniter frame work.
    it is working fine in locahost and ipadress based pc.
    and i have placed folder in godday,com
    it is showing login page succesfully
    but
    when i enter username and pwd it showing

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Apache Server at zoom.scintillareinfotech.com Port 80 ”

    Any one please help me to solve this issue
    please

  20. Alex Guzun says:

    thanks a lot, your .htaccess rules solved my problem after spending a lot of hours looking for a solution.

    Thank you!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s