Yearly Archives: 2009

Where are the Backup Files in Plesk?

By default, they’re located in

/var/lib/psa/dumps

It’s useful to clear this directory out every once in a while, especially because Plesk doesn’t overwrite old backups.

So if you ever find that you’re using 60GB of storage on your system, but are fully aware that your entire site shouln’t be bigger than 100MB, then this is a good place to start looking.

How to update multiple WordPress installations in one swoop?

We’ll do that with the help of our friend the “cp” command and SSH access to our server.

You can find a good manual for all the switches at Tux Files or ask The Die, or simply try “cp –help” at the command prompt.

I use “cp” to update multiple installations of WordPress on the same server, whenever an upgrade is available.

Rather than hit the “upgrade”button in each back end, which will download and unpack the files for each installation, I only need to download the latest WordPress tarball once (it’s available at http://wordpress.org/latest.tar.gz or http://wordpress.org/latest.zip). I then make amendmends if and when I need them, and then cp the whole directory into all my installations.

Here’s the full command I use:

cp -r /tmp/wordpress/* /path/to/my/site

-r means I want to copy directories as well as files (recursively).

The trouble here is that I’m being asked each time if I really want to overwrite that one file – so we need to find a workaround there. The -f switch doesn’t do the trick, for reasons unbeknownest to me. Therefore, let’s look at Pipes. Since our answer is always YES (or y for short), we can put that in front of our command, and then execute it like so:

y | cp -r /tmp/wordpress/* path/to/my/site

You could even go a step further and write a shell script that’ll take care of all your installations for you.

Maybe we’ll cover that when I figured out how to do it.

Until then, enjoy 😉

WordPress.com vs WordPress.org self-hosted

WordPress is my life and my passion – I wouldn’t know what to do without it. I often recommend it, I often install it and I teach people about it.

One of the question I often get asked by beginners is “what’s the difference between WordPress.com and this self hosted thing”? Let me explain.

Continue reading WordPress.com vs WordPress.org self-hosted

PayPal Buttons are not to scale in Thesis

Indeed they’re not, they look waaaaay to big and ugly.

Help is at hand by adding this code to your Cutsom CSS File in Thesis:

Instant relief.

CSS Dropdown Menu hides behind Videos

Yes, that’s an annoying one – and it has less to do with your Theme’s CSS and more to do with teh Flash Player.

Easy remidy is at hand, even though it means that you need to add code to each video.

Here’s how you do it:

Your videos will be embedded with both <OBJECT> and <EMBED> tags to make Internet Explorer and Firefox happy at the same time. You need to amend the following statement in the <OBJECT></OBJECT> tags:

You also need to put the following attribute into your <EMBED> statement:

Happy Days 😉

How to install MySQL on CentOS

Assuming you’d like to run WordPress on your very own vanilla CentOS system, open a terminal window and do the following:

You have to be logged on as root to do this.

The next thing you probably want to do is create a database so you can run WordPress on it. As you may know, we need phpMyAdmin to do this, so we’ll install that next:

In case it doesn’t work, phpmyadmin is available from EPEL or RPM Forge – check out this article if you haven’t got it on your system.

Now we need to restart apache so it’ll know about his new companion:

Excellent! We’re getting there. Now let’s create that database….

Well, I’m stuck here! I’ll let you know when I’ve figured it out. Until then, happy googling 😉

How to modify an existing theme

All WordPress Themes are released under the GNU, which means you’re free to amend and modify them as you please. That’s good news if you come across a layout that you like to 90%, and you’re up for the challenge to get down and dirty with some code.

The WordPress Codex is very good at explaining in detail how to modify a theme, but it’s fairly complex if you’re starting out. Let me give you a quick overview on what WordPress does to display your page in a browser:

Display your favourite WP site in your favourite browser. Then right click and display the source code of that site. What you see now is what your browser turns into something nice to look at: your page.

Even though all this code gets displayed at once, it is sent to the browser “on the fly” by WordPress if a user requests the page. This process happens in snippets of code, which is made up for several files that make up “the theme”.

If you have a look at a theme directory (usually wp-content/themes/youthemehere/), you’ll see several files. One of them (index.php) is the first file that’ is used to display a theme. This file calls other files, such as header.php, sidebar.php, footer.php and many others.

Part of the challenge is to find where the piece of code is that you’d like to modify. Your navigation menu at the top may be called in the header.php file,  or it may be called from index.php. You have to play detective to figure it out.

You can do this from within WordPress by navigating to Appearance – Editor. Select the theme you want to modify at the top right your current theme is already selected. On the right side you see all the files your theme is made of. Have a look at Anatomy of a Theme to find out more about those.

If you want to make a change, your files need to be writable on the server (do this with an FTP client such as FileZilla, and set your theme files’ permissions to CHMOD 777).

Before you start to modify any code, I highly reccomend to copy your entire theme folder to a safe place. You’d be surprised what a missing </div> tag can do to your design…

Have fun!

How to replace a Header Image

Not every theme provides a convenient “upload header” option. That’s luxory really. But there’s a fairly easy way to replace every header image in every theme with one of your own pieces of art.

Here’s what you do:

Right-click on the image you want to replace and select Properties. This will give you an idea how big the image is, and what its filename is. Note both down and open Photoshop or similar).

Select an image you’d rather like, and crop it to the exact same dimensions of the image you’d like to replace. Depending on the format of the original image, save yours as a GIF, PNG or JPG with medium compression (say 70), ideally using the Save for Web option.

Next open your favourite FTP client such as Filezilla and login to your site via FTP (not via WordPress). Find your theme’s directory (usually in wp-content/themes/themename) and locate that image file. Sometimes it’s right there in front of you, sometimes it’s in a subfolder. Have a quick poke until you find it.

Next, copy your own image into that directory. Rename the original image to something different, and give your own image the name that the original image used to have. Note that it’s cAsE sEnsitIve!

Refresh your site, and – in an ideal world – your own image will show up.

Troubleshooting:

  • If you see the old image, clear your browser’s cache and try again.
  • If you still see the old image, you’re replaced the wrong file…
  • If nothing shows up, your image is spelt differently than the original image.

When in doubt, check your sites source code and see which image filename is called. Rename your image accordingly. Keep in mind that Acuity Training is available today for almost any specific thing, you can learn anything you just need to ask and listen then do.
Good luck!

How to increase your PHP Memory Limit

With certain plugins, you may encounter error messages that tell you your PHP memory limit is not high enough. It usually means: you need more!

Like your computer being really slow when you run out of memory, PHP does the same thing, sometimes refusing to work flat out. That’s not so good.

There are several ways of changeing this, and I’ll go through a couple of options here:

Editing your .htaccess File

This is probably the safest and easiest way to adjust your PHP Memory Limit. If you don’t know what a .htaccess file is, have a look at this article.

In a plain text editor, open the file and add the following value:

php_value memory_limit 32M

The default value is set by your server (usually 16MB), and line of code will change it for your current directory. Change it whatever you please (I’d recommend 64 or 128M), but please note that some hosting companies may not allow this.

If you don’t have a .htaccess file, just save a plain text document with the above line, upload it to your root directory, and rename it .htaccess – refresh your browser, and you should be good. If in doubt, clear your browser’s cache – it works wonders at times.

Editing you php.ini File

This of course is only possible if you have access to this file. That’s only the case if you have direct access to your server. Ignore this method if you’re on a shared hosting package.

Open the file and have a look for the following line of code. It’s usually located in the section “Resource Limits”:

memory_limit = 32M  ; Maximum amount of memory a script may consume (32MB)

Again change the value to something you’d rather see here. Save the file, reboot your server, and you should be sorted.

How to check if my changes have taken place

Once simple and straightforward way is to check if your plugin is working now, preferrably without that error message.

If you’d like to be more certain, have a look at this very simple WordPress Plugin by Next Gen Gallery creator Alex Rabe: it’s called WP Memory Usage. It’s a friendly little thing that will show you not only your PHP memory limit, but also your current PHP memory usage (as the name suggests).

As always, good luck 😉

What is a “Point Release”?

With the arrival of WordPress 2.8.5, I mentioned to my good friend Dave Lee that this is a “point release”. He didn’t quite know what that meant, so I thought maybe I’ll share the knowledge.

Many if not all software projects have regular improvements that the coders come up with. Usually for reasons for security or some operational improvements. These improvements are indicated by a higher version number. As an example, Microsoft Office 2007 is a higher version number that Office 2003, because it’s a later release with major operational changes. Other examples:

  • WordPress 2.7 compared to WordPress 2.8
  • Filezilla 3.1 compared to Filezilla 3.2
  • Firefox 3 to Firefox 3.5
  • Internet Explorer 7 to Internet Explorer 8

After an initial release, minor bug fixes and non-major additions may be released, which improve the product, but don’t make fundamental changes. This is called a “point release”.

It usually means the overall look and feel of the product stays the same, and no major features are added (or removed for that matter). With point releases, you see version updates such as

  • WordPress 2.8.5 over 2.8.4
  • Filezilla 3.2.8.1 over 3.2.8.0
  • Firefox 3.5.2 over 3.5.1
  • Internet Explorer 8.0.6001.18702 over an smaller number after the initial point

Usually, the higher the number after the point, the later your version is – and (apparently) the better your software should be working.

Hope this helps!