Archive
Tag "tutorial"

HOWTO: Fix upload errors for WordPress on sites hosted on Nearlyfreespeech

Oh, how I hate ‘PHP safe_mode.” Unfortunately for me (and many others), this is turned on by my host, Nearlyfreespeech.net.

While this mode is turned on, you won’t be able to upload files to your blog through WordPress, which is rather annoying when inserting an image. You also won’t be able to make changes to your theme or plugin files.

The reason is because the mode disallows PHP scripts from editing a file or folder that does not have the same group as it does. It also requires that the script doing any kind of writing be part of the group “web.”

I ran a quick Google search on the problem and found a solution that works. Here are the instructions (from the author’s blog):

1)

Download Putty.

2)

Download and install the FTP client FileZilla. You won’t actually be using it to do much, but it makes it much easier to see what Putty’s doing.

It doesn’t absolutely have to be FileZilla – if you’ve got another FTP client installed, and it can do SFTP and can show you a file’s permissions, owner, and group, then that’s fine.

3)

Open Putty. There’ll be a box that says “Host Name (or IP address).” Into that box, paste “ssh.phx.nearlyfreespeech.net”. This is NearlyFreeSpeech’s SSH Hostname.

4)

Hit the “Open” button. The first time you do this, you will see a very scary-looking dialog box, saying something like “The server’s host key is not cached in the registry. Indescribably horrible things will happen to you if you click ‘Yes’ down there. My brother died that way.” It’s probably fine, hit “Yes.”

5)

A terrifying terminal window will appear, black as a moonless night. It will say “login as:” Type in your username. This is the same as your FTP username, and can be found on your “Site Information” page.

6)

It’ll ask you for your password. Type that in.

7)

Open FileZilla and log into your account using SFTP. You do that exactly the same way you log in using normal FTP, except that you put “ssh.phx.nearlyfreespeech.net” in the “Host” box instead of “ftp.phx.nearlyfreespeech.net,” and select “SFTP” instead of “FTP” in the “Servertype” box.

The first time you do this, there should be a dialog box asking if you’re sure you want to go through with this and talking about bad guys coming to get you, but you can just ignore it. They’re probably very small bad guys.

When you’re logged in, navigate to the directory WordPress is installed in and look at your file permissions and owner/group columns. Go into a few subdirectories and check them out, too.

In all likelihood, your owner/group column says “me me” all the way down. (If you have an .htaccess file in there, it may possibly say “web me” or “web web.” Don’t worry about it.) Ideally, your file permissions are all set to 664, and your directory permissions are set to 775. If not, we’ll change them in a minute.

7a)

Oh, and if you don’t have an .htaccess file in the main WordPress directory, create an empty one now.

8)

Putty starts out in your “htdocs” directory, aka your “public” directory. If you installed WordPress directly in this directory, skip to the next step.

If not, we need to change directories, using the brilliantly namedbash command “cd”. Figure out the pathname for your directory, and type in:

cd path

For example, if your WordPress installation’s in /htdocs/wordpress or /htdocs/personal/wordpress,

cd wordpress
cd personal/wordpress

9)

Okay, so you’re in your WordPress directory. Type in

ls -al

A long list of all the files in the directory will appear. The entries should look something like this:

drwxrwxr-x 8 me me 2048 Jul 3 11:06 wp-admin
-rw-rw-r-- 1 me me 32776 Jul 3 10:54 wp-app.php
-rw-rw-r-- 1 me me 129 Jul 3 10:54 wp-atom.php
-rw-rw-r-- 1 me me 1026 Jul 3 10:54 wp-blog-header.php

Yeah, it looks pretty much like what you’re seeing in FileZilla. The incomprehensible string of characters at the beginning of each line represents the file’s permissions, and the “me me” after it means that the file’s user and group are both “me.”

10)

This is the part where we actually change something. We will be changing every single file and subdirectory in your WordPress installation at once. If you’re going to chicken out, do so now.

We’re first going to change everything in the directory’s group to “web”. The command to do that is

chgrp -R web *

Type that in and hit enter. There’ll probably be a short pause before the command line reappears again.

Once it has, go into FileZilla, move to another directory, then move back. Your owner/group column should now say “me web” all the way down (except possibly for the .htaccess file, which might say “web web”). Now move into a couple of subdirectories and check them out. We did it!

11)

We probbbably did it. Just to double-check, go back to Putty, and type in

find . -group me

This will search for any files in the directory that are still part of group “me”. If you installed WordPress via Subversion, there may still be some in a directory called .svn. You can ignore those – as long as there aren’t any others, you’re safe.

12)

Now we’re going to make sure your file and directory permissions are all correct. They should be fine already – a fresh WordPress install has the correct permissions automatically – but if you or anyone else has been fiddling around with the installation trying to fix things, you may have changed some to 777 or something, which is not good. So just to be paranoid, we’re going to reset them to the default.

First, we want to change all your files’ permissions to 664 – that is, group-writable. To do that, type

find . -type f -exec chmod 664 {} \;

Now, we’ll change all the directories’ permissions to 775 (group-writable all-executable, because directories need to be executable if you ever think you’ll want to, you know, open them):

find . -type d -exec chmod 775 {} \;

Annnd go check around in FileZilla to make sure everything looks right.

13)

Now go test whatever didn’t work before in your WordPress installation. Hopefully it works now!

14)

Remember that whenever you upload a new file via FTP, its group will always be “me” by default. This means that next time you upgrade or install a plugin that needs to be able to write to files, you’re going to need to go back into Putty and change everything to group “web.” Again, the command to do that is:

chgrp -R web *

Thanks for the instructions, Snarp!

Comment

HOWTO: Add fixed position side tab buttons to your website

UPDATE 10/18/2010: I’ve updated the image files. The link below should redirect you to the newer version.

Social media integration with your website is very important, but where do you put the links to your Facebook page or Twitter account?

The usual method of placing a few buttons or two on your sidebar helps with their visibility, but I’ve found a better way to do it: fixed position side tab buttons.

That’s a long name for it isn’t it? :) Here’s what it looks like:

fixed position side tab buttons

Here’s what it looks like in action on Postertext.com:

Side tab button in action on Postertext.com

The concept is simple: When the webpage is scrolling up and down, and there are elements that do not move (remaining in a fixed position), the elements that are not moving immediately grab your attention. For example, I’m pretty sure you’ve come across those nifty Feedback tabs that sit on the sides of a website. You remember it because it jumps right out at you. Hell, I’ve even clicked on it before. Now, you can do the same for your social media buttons.

Here’s how to do it:

1) Download the necessary button images here (I’ve also included the .PSD files):  http://peterkao.com/documents/Fixed-side-tabs-v2.zip

2) Upload the images to your server.

3) Copy and paste the following CSS code into your style sheet. Remember to change the URL path of the images! Also, you can switch the position of the tabs from the right side to the left side by changing “right” to “left.”

/* ==== START Side tabs buttons by Peterkao.com ==== */

#fbtab{

background: url(http://postertext.com/sites/all/themes/frame/images/Like.png) no-repeat; /* Path to Image */

right:1px;  /* change this to left: 1px; to put it on the left of the screen */

top:275px;height:45px;width:32px;margin:0;padding:0;position:fixed;z-index:5000;}

#fbtab a{display:block;width:100%;height:100%;}

#twtab{

background: url(http://postertext.com/sites/all/themes/frame/images/Follow.png) no-repeat; /* Path to Image */

right:1px;  /* change this to left: 1px; to put it on the left of the screen */

top:328px;height:45px;width:32px;margin:0;padding:0;position:fixed;z-index:5000;}

#twtab a{display:block;width:100%;height:100%;}

#rsstab{

background: url(http://postertext.com/sites/all/themes/frame/images/RSS.png) no-repeat; /* Path to Image */

right:1px;  /* change this to left: 1px; to put it on the left of the screen */

top:381px;height:45px;width:32px;margin:0;padding:0;position:fixed;z-index:5000;}

#rsstab a{display:block;width:100%;height:100%;}

/* ==== END Side tabs buttons by Peterkao.com ==== */

4) Insert the following HTML code just before your closing </body> tag of your website. Again, remember to change the URL to your own:

<!– START Side tabs button by Peterkao.com –>

<p id=”fbtab”><a href=”http://facebook.com/MYURL”></a></p>

<p id=”twtab”><a href=”http://twitter.com/MYURL”></a></p>

<p id=”rsstab”><a href=”http://MYURL.com”></a></p>

<!– END Side tabs button by Peterkao.com –>

Your all set!

This will work for all browsers except for Internet Explorer 6, which Microsoft is killing off anyways.

Enjoy!

PS: I first found out how to create these tab buttons here, and extended it to include more social media buttons. Credit goes to schoberg.net!

- Peter Kao

Comment

HOWTO: Configure Microsoft Exchange and Outlook Web Access for Thunderbird

PLEASE READ:

If you have a problem with the add-on, please contact the guys over at http://groups.google.com/group/thunderbird-webmail-extension They will be able to help you more than I can. They’re the developers of this add-on.

Microsoft has an amazing way of wasting my time. See Microsoft Atlas Cheats on Online Reach Prediction Research Paper and Wow, My Windows Vista Self-Destructed.

It took me a full hour to configure my Microsoft Exchange/OWA email account for Thunderbird and lucky for you I wrote a set of easy instructions for you to follow!

1) First download the WebMail Thunderbird add-on (ex. Web-Mail-x.x.x) which will help you connect your Thunderbird to your web-based email accounts (ex. Gmail)

Note: If you’re new to installing add-on’s for Thunderbird, simply right-click the link that leads to the add-on and select “Save Link As…” Then, go to Tools in Thunderbird followed by a visit to Add-Ons, then to Install on the bottom.

2) After installing it, you’ll need an add-on for the add-on. Sounds funny doesn’t it? You can download it here. There will be a list of add-on’s that you can choose from (there’s even one for Gmail), but for our purposes download and install the file that starts with ‘owa’. The installation should be the same as for any Thunderbird add-on. This time, you will need to restart your Thunderbird for the add-on’s to initiate.

3) We now need to configure the Webmail add-on’s add-on. Go to Tools -> Add-ons, select Webmail-OWA and click Options. Visit the Domains tab and click Add.

In the Domain field, enter whatever follows at the end of the @ symbol of your email address (ex. gmail.com)

In the URI field, enter the URI of the Outlook Web Access address (ex. http://www.yourwebsite.com/exchange or http://mail.yourwebsite.com)

4) Now you’re ready to start creating your account (Tools -> Account Settings -> Add Account) . When presented with the new window, select Webmail as the account type and set youremail@yourwebsite.com as the Incoming User Name. Hit Finish when you’re done.

5) Go back to the Webmail add-on’s add-on option screen (Tools -> Add-ons, select Webmail-OWA and click Options) and now access the Accounts tab. If you had set up everything correctly in the step above, you should see your recently created account. There are additional settings there that might need tinkering and depending on how your Microsoft Exchange was set up you might not need to change anything at all. If your account can’t connect to the server, then just come back and select some of the options. Unfortunately, trial-and-error is the only way here.

6) At this point, you should be able to read emails. In order to write emails, go to Account Settings again (Tools -> Account Setting) and click Outgoing Server (SMTP). On the top right-side, hit Add…

In the Description field: Enter the name that will describe this account. (ex. Gmail Account)

In the Server Name field: Enter ‘localhost’

Port should be set to the default of ’25′

Check the User name and password box, and type in your User Name in full (ex. youremail@yourwebsite.com)

Leave the rest alone and hit OK.

7) Last step! With the Account Settings window still open. Click on your Web Mail account and in the Outgoing Server (SMTP) drop-down, select the description name you provided in the step above and voila! You’re done!

A little bit complicated if you ask me, but it’s all worth it. You can now use Microsoft Exchange or your Outlook Web Access account on Thunderbird!

How’s that for my first tutorial?

Peter Kao

Comment

Learn Photoshop with Donnie in “You Suck at Photoshop”

Want to learn how to use Photoshop? Let Donnie guide you with his hilarious tutorial videos!

Episode 1:

Episode 2:

Episode 3:

Episode 4:

Episode 5:

- Peter Kao    

Comment