It’s nice when things work on localhost, but when you move them to GoDaddy’s server, you might encounter some problems. A few tips for anyone who has errors coming up:

Basic setup
Make sure you’re using Linux hosting with Hosting 2.0 enabled. This lets you change things like PHP.INI

Creating and editing PHP.INI
Take the PHP.INI from your localhost and upload it to the root directory of your GoDaddy host account. Rename PHP.INI to PHP5.INI if you have PHP 5 enabled on your account, or your file won’t be recognized.


Troubleshooting error messages

As for specific error messages, like Cannot modify headers, just run a Google search and you’ll usually see one setting that will fix it. I was getting “Cannot modify headers” errors, but simply turning “output_buffering = on” or “output_buffering = some_value” where some_value > 0, you should be set. Mine is set to output_buffering = 4096 (this is all in PHP.INI).


Handling rewrites and htaccess

If you need to do any rewrite stuff, you can upload .htaccess to the directory that you want the rewrite rules to apply. Usually, this is the root directory of your application. In my case, my app is stored in a subdirectory (root.com/myapp) so I uploaded it to /myapp and the rewrite rules will apply to that directory and all of its subdirectories (but not to root.com). On my localhost, I’m doing rewrites in httpd.conf where I declare virtual hosts, but on GoDaddy this is proobably not necessary.

Problems loading CodeIgniter controllers?
This is CodeIgniter-specific, but you’ll need to add the following to your config.php file in order for controllers to properly load: $config['index_page'] = “index.php?”;
$config['uri_protocol'] = “QUERY_STRING”;. Then you’ll need to add the rewrite rules:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]

To access the app, you’ll need to use root.com/app/?welcome (or whatever controller you want to call)

Problems using SENDMAIL or sending e-mails using CodeIgniter’s e-mail class?
I saw a lot of people pulling their hair out over the e-mail class. It’s very simple, open up your email.php file in CodeIgniter (system/application/libraries/) and fill in all the details:

var $mailpath = “/usr/sbin/sendmail”; // Sendmail path
var $protocol = “sendmail”; // mail/sendmail/smtp
var $smtp_host = “relay-hosting.secureserver.net”; // SMTP Server. Example: mail.earthlink.net
var $smtp_user = “yourEmailLogin@yourGoDaddyDomain.com”; // SMTP Username
var $smtp_pass = “yourEmailPassword”; // SMTP Password
var $smtp_port = “25″; // SMTP Port

That should fix it. I do not include in-line parameters whenever I send mail from my controllers. I simply fill in the to, from, subject, body, and send it. I don’t change the connection details.

GoDaddy isn’t so bad after all. I’m still trying to figure out how to make my Email class work on GoDaddy, I’ll post an update when I figure it out.