Everything from Virtual Private Server (VPS) tips, to CCTV and more.
Random header image... Refresh for more!

Category — Useful Stuff

Modifying your error pages.

The location of the error pages is

/var/www/error

Editing the files in that directory enables you to have custom error pages, noindex pages, 404 pages etc.

You can customise them to suit your sites look and feel, or even add extra functionality if desired.

Note, the above location may vary on different servers - the location given is where they are on my goddady centos vps. You will need to do your own research to find the exact location if you are not there!

December 26, 2007   No Comments

Quick n easy search and replace in mysql

I had to do a quick search and replace on a field that had some records with the ‘http’ bit duplicated, so this did the trick.

update `pages` SET url=(replace (url, ‘http://http://’,'http://’))

November 2, 2007   No Comments

Virtual Terminals via SSH

If you want more than one window when using SSH, instead of opening up multiple ssh sessions/putty windows you can type

screen -S 1

This will start the screen utility, and give you a new window.

To open a new window use CTRL-A C

Top swop windows use CTRL-A window number or just CTRL-A

Its handy if you want to have a couple or more windows open and swap between them fast.

October 31, 2007   No Comments

Great little bit of software.

I have been on the lookout for a decent editor/ftp/putty type utility, and finally I came across winSCP from

http://winscp.net/eng/index.php

Only used it for a few minutes, and already I feel at home, its nice and intuitive, very fast, and if your after something like this, you should check it out.

Anyone know of any other similar (free) software like this, if so leave a comment so I can try it, cheers!

October 13, 2007   No Comments

Restoring a mysql backup.

Its easy enough to use phpmyadmin to restore backups, but its pretty limited when it comes to larger databases - so I tend to use the command line to restore those.

I usually export the file ‘zipped’ (you can do gzip if prefered, and alter the unzip part later) then ftp it to my server, to a location out of the webroot.

After using

unzip filename.sql.zip

you end up with the unzipped file, I normally delete the original zip to save space on the server at this point.

To import the database (you need to make sure you have already set up a database user in the control panel etc) use the following syntax

mysql -u username -ppassword database_name < unzipped-file.sql

then wait, whilst it imports.

October 11, 2007   No Comments

Restarting mysql at the command line.

There may be times where you need to restart mysql at the ssh prompt, rather than going to the trouble of logging into godaddy, and firing up the simple control panel.

You can do this with

/etc/init.d/mysql restart

It does as it implies, stopping and restarting the mysql server.

October 11, 2007   No Comments