How to set up Wordpress on Leopard

Posted by ljmacphee on October 26, 2007 under how to, osx, wordpress | 4 Comments to Read

Gad, it is just as miserable and painful as it was under Panther.

1) Install MySQL 4.1 or 5.x

2) Turn on PHP in Apache

3) Fix broken socket

4) Download and install WordPress

Step 1 MySQL:

- Download MySQL 4.1
Unpack it and install and tell it to start on startup.

- Turn on SU account. Open up a Terminal Window and type:
sudo passwd root
Give it a good password. You’ll need su to edit files in a bit

- Configure MySQL
cd /usr/local/mysql/bin
./mysqladmin -u root password
[Give it a good password, if it refuses to connect reboot your computer. Also check in your System Preferences MySQL that MySQL is running and told to turn on at boot. ]

- Once you have the root user set up on MySQL set up an account for yourself
./mysql -u root -pYOURPASSWORD

- You should now see a sql> prompt
GRANT ALL PRIVILEGES ON *.* TO username@localhost IDENTIFIED BY ‘userPassword’ WITH GRANT OPTION;
exit;

- Make sure it worked
mysql -u username -puserPassword
Did you get a sql> prompt? If so you’re cool, if not reboot, I’m finding that helps and if not try again. You need to get MySQL running to use Wordpress.

- Life is much easier if you set up a link in your path to mysql

as su

cd /usr/bin

ln -s /usr/local/mysql/bin mysql

Now you should be able to access mysql from any where on the computer.


Step 2: Turn on PHP in Apache

- Turn on WebSharing in System Preferences Sharing

cd /etc/apache2

- Edit httpd.conf , you need to uncomment the line
LoadModule php5_module libexec/apache2/libphp5.so
Thanks and more info here if you are stuck

Step 3 Fix broken socket
- cd/etc/
- copy php.ini.default to php.ini
- edit php.ini
Change the line
mysql.default.socket =
to
mysql.default.socket = /tmp/mysql.sock
Thanks and more help here if you need it for this step

Step 4 Wordpress:

- Download and unpack your favorite version to /Library/WebServer/Documents

- Edit config.php to use the password, and user name and database you created in step 1. If you didn’t create a database do so now.

- type 127.0.0.1/wordpress/ in your browser window and you should see the familiar WP set up screen.
If you do not see the set up screen try this: create this test.php file and it should tell you what is your problem:
if ( $cn = mysql_connect ( “localhost”, “username”, “password” )){
echo “connected”;
}else{
echo “not connected - ” .mysql_error();
}

Use the username and password you set up in mysql.

NOTES:

If you decide to wipe and re-install everything on your computer, you must get PHP/Apache/MySQL up and running BEFORE you do the 10.5.1 update.

If after installing MySQL you are unable to create a database ( errno 13 ) then log on to a terminal as root and change the owner / group of everything in the mysql directories to mysql/mysql.

> chgrp -R mysql *

> chown -R mysql *

You must also create a var and run directory in your /usr/local/mysql directory and make sure they are owned and in the group mysql.

Bulk Image Processing for websites using Image Magick

Posted by ljmacphee on July 20, 2007 under graphics, how to, linux, osx, tools | Be the First to Comment

You might be developing a site to show off someone’s photos. Or maybe you are building an online store and you have hundreds of images to process. Well we all love GIMP but re-sizing 500 photos for thumbnails would give anyones mouse hand a cramp if you did them one by one.

When you have lots and lots of photos to process you will want to set aside GIMP and use ImageMagick. There are binary versions available for Unix/Windows/OSX and source code versions available for those of you who prefer to compile your own. This is Open Source, free for you to use software.

Directions for installing ImageMagick (* see note for OSX at bottom of post )

Now I’m old school and often work from a command line or terminal. Those of you who would rather have a graphical interface might want to check out JMagick, a Java interface for working with ImageMagick. This is just an interface, ImageMagick will need to be properly installed first for the interface to work.

Once you have it up and running you can batch process your images.

For instance if you want to create thumbnails for 100 jpg images:
Open up a terminal window ( Command in Windows Terminal in OSX )
cd to the directory with the images
type at the command prompt and hit enter
convert *.jpg -resize 100 thumbnail%03.png

This will convert all files ending in .jpg in this directory to png files that have a width of 100 pixels and are named thumbnail000.png to thumbnail099.png.

You can convert jpgs to png to gif and any which way between them.

You can do any of the following conversions to the files:
[-adaptive-blur • -adaptive-resize • -adaptive-sharpen • -adjoin • -affine • -annotate • -antialias • -append • -authenticate • -auto-orient • -average • -backdrop • -background • -bias • -black-point-compensation • -black-threshold • -blue-primary • -blur • -border • -bordercolor • -borderwidth • -cache • -channel • -charcoal • -chop • -clip • -clip-mask • -clip-path • -clip-path • -clone • -coalesce • -colorize • -colormap • -colors • -colorspace • -combine • -comment • -compose • -composite • -compress • -contrast • -contrast-stretch • -convolve • -crop • -cycle • -debug • -deconstruct • -define • -delay • -delete • -density • -depth • -descend • despeckle • -displace • -display • -dispose • -dissolve • -distort • -dither • -draw • -edge • -emboss • -encoding • -endian • -enhance • -equalize • -evaluate • -extent • -extract • -fill • -filter • -flatten • -flip • -flop • -font • -foreground • -format • -format • -frame • -frame • -fuzz • -fx • -gamma • -gaussian-blur • -geometry • -gravity • -green-primary • -help • -iconGeometry • -iconic • -identify • -immutable • -implode • -insert • -intent • -interlace • -interpolate • -label • -lasso • -lat • -layers • -level • -limit • -linear-stretch • -linewidth • -list • -log • -loop • -magnify • -map • -map • -mask • -matte • -mattecolor • -mask • -median • -metric • -mode • -modulate • -monitor • -monochrome • -morph • -mosaic • -motion-blur • -name • -negate • -noise • -normalize • -opaque • -ordered-dither • -orient • -page • -paint • -path • -pause • -pause • -pen • -ping • -pointsize • -polaroid • -posterize • -preview • -print • -process • -profile • -quality • -quantize • -quiet • -radial-blur • -raise • -random-threshold • -recolor • -red-primary • -regard-warnings • -region • -remote • -render • -repage • -resample • -resize • -reverse • -roll { • -rotate • -sample • -sampling-factor • -scale • -scene • -scenes • -screen • -seed • -segment • -separate • -sepia-tone • -set • -shade • -shadow • -shared-memory • -sharpen • -shave • -shear • -sigmoidal-contrast • -silent • -size • -sketch • -snaps • -solarize • -splice • -spread • -stegano • -stereo • -storage-type • -strip • -stroke • -strokewidth • -support • -swap • -swirl • -text-font • -texture • -threshold • -thumbnail • -tile • -tile-offset • -tint • -title • -transform • -transparent • -transparent-color • -transpose • -transverse • -treedepth • -trim • -type • -undercolor • -unique-colors • -units • -unsharp • -update • -verbose • -version • -view • -vignette • -virtual-pixel • -visual • -watermark • -wave • -white-point • -white-threshold • -window • -window-group • -write]

There are hundreds of detailed examples here: ( ImageMagick Examples )

*Note for OSX installations:
You will need to edit your .bash_profile file. It is in your home directory, and add the following lines.

#ImageMagick Stuff
export MAGICK_HOME=”/usr/local/ImageMagick”
PATH=$PATH:$MAGICK_HOME/bin
export PATH
export DYLD_LIBRARY_PATH=”$MAGICK_HOME/lib”
# end Image Magick Stuff

Save the file, close the terminal window and open a new one to cause .bash_profile to run.

How to add or change the bookmark image for your website

Posted by ljmacphee on April 30, 2007 under HTML, blogger, blogger template, gimp, graphics, hack your template, how to, osx | Be the First to Comment

The image you see next to the website URL or in your bookmarks menu is called ‘favicon.ico’.

If you are hosting your website on your own server, just add a 16×16 pixel ‘favicon.ico’ file and a 32×32 pixel ‘largefavicon.ico’ file to the top directory. This is the same directory your index.html page for the site is kept.

If you are hosting your website on blogger or another service where you do not have access to the main directory you have to host your favicon.ico image file where ever you host your other website images.

Then add the following two lines to the html files on your site. These lines go in the <head> section of each file. If you are on blogger are using another blog type set up just edit the main html file for your site. { On blogger go to Layout->Edit HTML and put the two lines under the line <head> }.

Now edit these two lines so the path is where your favicon.ico is kept:

<link rel=”shortcut icon” href=”http://imagehosting.com/favicon.ico” />
<link rel=”icon” href=”http://imagehosting.com/favicon.ico” />

To create your favicon.ico file you can use your favorite photo editor. I use Gimp. Create the icon you want and save it as a 16×16 pixel png file. After you have created and saved the file, change the file name from favicon.png to favicon.ico.

More information:
What is favicon.ico?
How to Make Favicon | Macinstruct

Backing up Blogger to your OSX Wordpress local installation

Posted by ljmacphee on March 27, 2007 under blogger, how to, osx, useful sites, wordpress | Be the First to Comment

I tried all the back up programs I could find. Maybe they work on Windows machines? I don’t know? I found none that work on OSX.

So for now, until I find a better solution, I set up multiple Wordpress blogs on my home computer. I then downloaded and installed the Wordpress new blogger import tool and I downloaded->imported my blogger blogs to my local Wordpress install.

I’m hoping to find a better solution. Or perhaps I’ll write a tool if time allows. For now this will have to do.

10 Step Install of Wordpress on OSX

New Blogger Import Plugin
Or try here:
New Blogger Import Plugin

To install multiple Wordpress blogs on your OSX machine you need to set up a new MySQL database for each one.

Then create multiple wordpress folders in your /Library/WebServer/Documents/ directory. One folder for each blog and give it name that’ll make it easy to keep each blog straight.

Then follow the same basic install instructions for each blog that Wordpress provides.

Install the New Blogger Import Plugin in each Wordpress installation and activate it.

Follow the instructions for downloading and importing your Blogger Blog.

It sounds painful, but the only painful part of all of this is getting MySQL installed and running properly. All else is easy.

One problem with this method is the import program imports everything every time. So you end up with duplicate entries, comments, etc.

To fix this log into mysql and delete the comments, categories and posts before doing the backup.
mysql> delete from wp_posts where post_author=’2′;
mysql> delete from wp_comments where comment_approved=’1′;
mysql> delete from wp-categories where category_parent=’0′;

See also:
Perl script to backup Blogger posts and images
Perl script to back up Blogger comments