Drupal coder

server management

Preparing Ubuntu Server for hosting Drupal sites

With the cheap prices of VPS hosting services these days, pretty much anyone can run his own server. Hosting your Drupal site on a VPS has a lot of advantages over running your site on shared hosting, but is a bit more difficult to get started. Using the following guide, you should be able to set up an Ubuntu Server on your VPS pretty easily. You'll install a full system with Apache, MySQL, SSH Server, PhpMyAdmin, ... We'll also configure the system with some minor tweaks that will cause a major performance boost over a barebones install.

Let's get started...

Create MySQL configuration file (my.cnf) on MAMP

If you ever find yourself in need to adjust some MySQL settings and you're running a MAMP server on Mac OS X, you can always create a my.cnf file using the following command:

sudo cp /Applications/MAMP/Library/share/mysql/my-medium.cnf /Applications/MAMP/Library/my.cnf

You now have created your own my.cnf file where you can adjust some settings. Please make sure restart your MySQL instance after altering the configuration.

You have a few other starting point for creating a my.cnf file. MAMP ships with 5 configuration files for some typical settings. The filenames should be self explanatory:

./Library/share/mysql/my-huge.cnf
./Library/share/mysql/my-innodb-heavy-4G.cnf
./Library/share/mysql/my-large.cnf
./Library/share/mysql/my-medium.cnf
./Library/share/mysql/my-small.cnf

Update: Beware: The my.cnf file might enable binary logging. This may create huge log files (gigabytes). Check out webchick's post how to disable mysql binary logging.

September 24, 2008MySQL, server management

MySQL server has gone away

I have had this one 2 times now. And it's always the same thing: too many fields in CCK.

Too many fields means too large queries to update the cache. And then MySQL goes down with this nice error message.

How to solve this? Increase the max_allowed_packet to a bigger number in your my.cnf (linux) or my.ini (windows).

If it's not there just add it.

max_allowed_packet=32M

Problem solved!

August 06, 2008Drupal, MySQL, server management

Case using for filenames of client side files when developing on LAMP

At this moment I'm integrating the HTML/CSS/JavaScript produced by a design bureau into a Drupal theme. And sometimes I was at the verge of pulling my hair out and calling names to the guy who created the images.

Please! If you know you're developing for Linux servers, check your use of letter cases! Or better... Just use dashes to seperate the words.

An example:

Suppose you have a filename you would like to call like 'BgCanvasLeftSpacesAndWhatever.jpg'. As soon as you mistype one letter (just the case), it won't work on a Linux/Apache server. But you wouldn't notice the difference if you just tested on your local OS X or Windows computer.

Spot the difference between 'BgCanvasleftSpacesAndWhatever.jpg'!!! Practically undoable.

If you would have used dashes, you would have spotted the difference immediately, because no Operating System or web server would allow you to drop the dashes.

So in the example you would have bg-canvas-lef-spaces-and-whatever.jpg.

And it looks better too ;)

January 22, 2008server management