Posts tagged: godaddy

Displaying an SVG hosted by GoDaddy

I’ve recently been contributing to the TorrentBoy Project and trying to keep some level of activity going for it at all times. The project still needs active contributors, especially if you’re any good with stringing coherent words together or connecting lines together to form pretty pictures. See 1889.ca for more information. Writers? Artists? Anyone!

How is this relevant? I told MCM, the brain behind the project, that I’d get off my butt and finally post the .svg I had created. Being that TorrentBoy is a collaborative project, it helps others if they have a “launching” point to contribute from. From my perspective, I’m hoping that someone can take my image of Crash with Waser Bwaster () and make him awesome.

Back to the point, GoDaddy doesn’t display .svg files by default. When linking to an SVG, the page will just spit out the source code to the image. Not very helpful. A temporary solution would be to change the .svg extension to .xml, which will then correctly display the image. But that’s not how we do it!

The solution is this. Stick the following lines into your websites root .htaccess file (the ~/html directory).

AddType image/svg+xml svg
AddType image/svg+xml svgz
AddEncoding x-gzip .svgz

Give it a try. Much thanks to this article for the solution.

sendmail from the command line in GoDaddy

This is another useful tidbit to use with the article, Backing up your Database (with GoDaddy and Cron).

What it does: Allow you to send mail to a specified email address by using the program sendmail.

You do this from the shell in your GoDaddy account. I shouldn’t have to tell you that this tutorial is meant for the shared Linux hosting account.

/usr/sbin/sendmail.real -f myaccount@theurl.com
intendedrecipient@theotherurl.com

Type that all on one line. Of course, change the addresses to suit your needs, then press <enter>. You’ll be greeted with… nothing happening. sendmail is now waiting for further instructions. So type the following.

Subject: whatever your subject is
And now you type your message below that

And you’ll still be left with nothing happening. Now sendmail is waiting for you to tell it that the message is over. So simply type a period on a line by itself.

.

And press <enter>. Your message should now send.

This is handy for a cron job where you want either a receipt that the cron job completed, or perhaps you want a file (backup?) sent to you on a regular basis.

Example:

/usr/sbin/sendmail.real \
-f test@example.com \
recipient@example.com
Subject: Testing for HowTo
This is just a test message.
And this is a new line.
.

The following email is what I received.

from test@example.com
to
date Mon, Apr 20, 2009 at 2:22 PM
subject Testing for HowTo
mailed-by bounce.secureserver.net
This is just a test message.
And this is a new line.

Backing up your Database (with GoDaddy and Cron)

In short, this is  a guide to setting up a cron job in GoDaddy so that your databases can be backed up (and later restored). It’s generally a good idea to regularly backup your databases, whether you think you need to or not.

This guide assumes that you are using the Linux hosting of GoDaddy.

First, get familiar with mysqldump. It’s the utility we’re going to use to do the backing up. Do you have access to your sites shell? It’s that thing you get when you log into yourdomain.com through SSH. I’ll assume you’ve got access to the command line to try this yourself and if you don’t then just follow along and trust me.

I’ll paste a facsimile of the mysqldump command that I use in my account, and then explain what it does. Keep in mind, the following command is continuous, all on one line, but I’ve broken it down to fit on this page.

mysqldump
-h DBHOSTADDRESS
-u DBNAME
-pDBPASSWORD
DBNAME |
gzip >
$HOME/html/somefolder/DBNAME_`date '+%m-%d-%Y_%H-%M'`.sql.gz

I’d like to point out the workings of that “date” thing first. Simply put, that gives the backup a name like “MyDB_03-18-2009_02-15.sql.gz” which tells us that the database, MyDB, was backed up March 18, 2009 at 2:15am.

DBNAME is whatever you named the database. As we all know by now, GoDaddy shares the database name and the database username, which is why it shows up so often.

DBPASSWORD is worth noting. There is no space between the -p and the password. That is not a typo. Just keep it as -pNoSpace or it will not work (of course, use the database password in place of “NoSpace”).

DBHOSTADDRESS can be found in the GoDaddy control panel. The control panel is found at

GoDaddy.com >> Hosting >> My Hosting Account >> Manage Account >> Databases >> MySQL

Then click the “Edit/View Details” Action for the database you want. The host address can be found in the Host Name row of the MySQL Database Information.

GZIP is what zips up the backup for us. It keeps the backup small (or at least smaller than the raw backup file).

$HOME is the full path to the backup directory. You do not need to worry about the path, just keep $HOME as it is.

And now for the easy part.

Create a file and write #!/bin/bash for the first line. Then on the second line, paste in the mysqldump command for your database. Remember to change the variables in the command to suit your account and database configuration.

Now change the permission of the script you just created to be executable by you. From the command line the command is

chmod 744 WhateverTheScriptIsCalled

You could probably change the permission from within an FTP program, like FileZilla, by right clicking and changing the permission.

Next, open Cron Manager. It is located in the Control Panel under the Content tab.

Give the cron job a name and set the frequency. Next, in the command box, browse to the location of the script you just created. Select it. Save. Done.

Laconica with GoDaddy

I may be jumping the gun here a little bit as I’ve only successfully managed to get Laconica talking to the database and have successfully registered my user. If for some reason not everything is up and working 100% then I’ll append a note to the end of this article. In the meantime, you’re probably here because you want to know if it’s possible to get Laconica, the micro-blogging utility that is the basis for which Identi.ca is built upon, working in a GoDaddy hosting account.

Yes you can. Here’s how.

The Laconica README says that Laconica requires that it is the only process using any particular database, so go ahead and create one from your GoDaddy hosting account manager. I’ve chosen MySQL 5.x myself. It’ll take a few minutes while a (presumably) real human sets up the database and permissions for your user. When the technician is done setting up your database then it should, after a page-refresh, show “Open Manager” in the database manager screen.

There’s a particular piece of info you’ll need now, which is the address of the database (different, often-times, for each database you set up). So click the “pencil” icon in the “actions” column. If you hover over the pencil it should say “edit/view details”.

When the page opens you’re looking for the “Host Name” which is something like “pXXmysqlXXX.secureserver.net”. That’s the location of the server holding your database and you’ll need it later on. So make a note of it and let’s carry on.

The next step would be to actually have downloaded the Laconica software. A link to the latest version can usually be found on the http://laconi.ca/trac/ site. Currently it is version 0.6.2 which was released November 18 of 2008.

Download it, extract the archive (the zip, tar, etc) and then open your favorite FTP client and transfer to your webserver (or copy it over via command line FTP). Don’t expect it to work just yet. You need to edit a couple files.

First, find the laconica_0.6.2/config.php.sample wherever you extracted the archive and drop the .sample part of it. Now open up config.php in whatever text editor you prefer and change the following lines:

$config['site']['name'] = 'Just another Laconica microblog';
$config['site']['server'] = 'n3wt0n.com';
$config['site']['path'] = 'micro';

n3wt0n.com becomes whatever your URL is, but don’t include http:// or it’ll screw it up. Or do, and you’ll see for yourself. Also, change “micro” to the name of the directory that Laconica exists in on your server. If you just copied the extracted directory over then it may be called “laconica_0.6.2” but I renamed mine to “micro”.

I also changed

#$config['site']['logfile'] = '/tmp/laconica.log';

to

$config['site']['logfile'] = 'laconica.log';

because I am hoping that the log file will be printed to the site-root (n3wt0n.com/) where I might be able to retrieve it some time, rather than the server’s /tmp/ directory where I cannot reach it. But that’s your call.

Last, but certainly not least, within the config.php file is the “db” configuration. Particular to working in a GoDaddy account, modify the following lines to suit your account.

$config['db']['database'] = 'mysql://DB_NAME:DB_PASSWORD@DB_LOCATION/DB_NAME';
$config['db']['ini_your_db_name'] = $config['db']['DB_NAME'].'/DB_NAME.ini';

Remember that with a GoDaddy account, the MySQL database username is the same as the database name. Thus “DB_NAME” is used for both. Change that to whatever you named your database. DB_LOCATION is that “pXXmysqlXXX.secureserver.net” thing we noted earlier.

Additional note:

mysql://DB_NAME:DB_PASSWORD@DB_LOCATION/DB_NAME

follows the format

mysql://username:password@serverlocation/databasename

That should cover the configuration, but there’s one more file we’ll need to change. Change the name of laconica_0.6.2/classes/laconica.ini to DB_NAME.ini (remember, DB_NAME is replaced with whatever you named your database). It should be noted that you may have to rename laconica.links.ini to DB_NAME.links.ini as well. I just haven’t played around long enough to know.

Another additional note:
Copy htaccess.sample and rename it to .htaccess
Within that file, change “RewriteBase /mublog/” to be “RewriteBase /micro/” where micro is the path to your laconica directory.

Now everything is set up for Laconica to work, all we need now is to import the database! That’s easy, too. Within the GoDaddy Hosting Contol Center, click “Open Manager” for your Laconica database and log in to the PHPMySQLAdmin interface. From the database drop down menu on the left, select the DB_NAME to bring up the database. Now on the right side of the screen click on the “import” tab.

The “Location of the text file” to import is the directory of the extracted Laconica archive/db/laconica.sql

Click “Go” at the bottom right of that screen and now you should be good to go with Laconica on your GoDaddy hosting account. And if it’s not GoDaddy then this was probably an easier task for you.

The best thing you can do for yourself to set up Laconica is to read the Laconica README.

Staypressed theme by Themocracy