Category Archives: Enterprise Server

WoodWing Enterprise and CentOS 6.4

Spent some time bringing up a CentOS 6.4 VM that ran Enterprise and Elvis.

Had to install a few things on the Apache/PHP/MySQL front. Below are the commands that I ran to to get things running for Enterprise.

Keep in mind that your mileage will vary here as how you installed CentOS (For instance did you make the selection to install a ‘Web Server’ when running the installer) will make a big difference on what you have to do.

After you have created the VM (In my case I used Parallels because…that’s what I had).

CentOS 6.4

Install the base goodies.

yum -y install httpd php mysql mysql-server php-mysql

For PHP I had to install a few other extensions:

yum install php-mbstring

To get this installed I had to reference another repository and then run the command. Be sure to check the link below to make sure you are getting the correct version.

a. ‘rpm -Uvh

b. yum install php-mcrypt


Need to install php-pear and gcc (should already be installed)

yum install php-pear gcc

yum install ImageMagick


yum install php-xmlrpc

yum install php-soap

Install PHPMyAdmin

I installed PHPMyAdmin to work with MySQL. I like the tool. Easy to install and use.

Enterprise configuration changes

You’ll need to make one change to the server config files for the ‘locale’ setting.
a. Open ‘config.php’

b. Add setlocale(LC_ALL,”en_US.utf8″);’ after file encoding section at the bottom of the file.


WoodWing Community Site article about ‘locale’ setting

WoodWing Enterprise and Solr – a dead simple install of Solr

Solr is a great tool when installed in conjunction with Enterprise. Lightning fast searching, facets…good stuff.

I’ve hand installed Solr and Tomcat for years. Every now and then however, SOMETHING happens that blows up the installation of Solr/Tomcat.

I finally got tired of fixing it and thought to myself “MacPorts has all the other stuff that I need. Why not Solr?”

Here’s how to install Solr using MacPorts

Install Solr

Start up Terminal
Update MacPorts by entering: sudo port self update
Install Solr: sudo port install apache-solr3
(this is version 3.6.2 of solr)
MacPorts will do its thing. Note that the ‘Jetty’ is being installed instead of Tomcat.

Install the new schema and server config files

Download the files you need from the Community site. This is the ‘Enterprise Solr Integration’ file containing the ‘schema.xml’ file and the ‘solrconfig.xml’ file.
Navigate to here:
Backup the existing ‘schema.xml’ file and the ‘solrconfig.xml’ files and then replace them with the ones you downloaded.
Start Solr

Start Terminal
Type in the command: sudo solr3
Solr should start. To see if it is working navigate to this URL:


Quitting Solr
In the Terminal window you started Solr in type ‘control-c’ where ‘control’ is the KEY on the keyboard and not the word.

Enterprise and Solr
Make sure to go into Enterprise’s ‘config_solr’ file and check the port that is entered at the top of the file. Make sure it matches the one that you are using with Solr.

If you have a pre-determined port you are using and the default doesn’t match the one you want to use then you’ll need to change the port that ‘Jetty’ is using.

Changing the Jetty Port

Navigate to this file:

Open the file in text editor

Search for ‘jetty.port’. This line should come up:

Name=”jetty.port” default=”8983″

Change the value of 8983 to the appropriate value

Save the file and restart Solr.

RAW files, ImageMagick and WoodWing Enterprise

Recently I had a partner that I was working with who asked the following question:

“How can Enterprise accept RAW files and build large usable previews?”

Good question.


This set of explanations and instructions assume that you have a certain level of skills that allow you to compile some server tools, modify Enterprise config and Server Plugin files.

In addition, since we are modifying the stock Enterprise installation you NEED to have a plan in place that will allow you to propagate the changes you are making to newer versions of Enterprise as updates and upgrades are released.

What are RAW files?

The best explanation that I can give is that a RAW file is exactly what the image sensor recorded at the time the image was taken UNAFFECTED by any processing. I think of a RAW file as a digital negative. (Don’t confuse that term with Adobe’s DNG stuff…that’s for another post!)

When I first heard people talk about ‘RAW’ files I thought that implied that there was one file type. Not true. Each camera manufacturer creates a RAW file type that then has a file extension defined by the camera manufacturer. A tool like Photoshop understands how to interpret the file but in the end will want to write out to something like the .psd or jpeg formats.

See more here:

In my case the sample files include extensions like .NEF, .CR2 and .IIQ

Image files and WoodWing Enterprise

WoodWing Enterprise uses several different mechanisms to deal with image formats.

The GD module that can be compiled with PHP is the first candidate to take a look at.

However, I know that GD does not support ‘RAW’ files. GD supports JPEG, GIF, PNG, SWF, TIFF and JPEG2000 files. If you want to see what your installation is set up to support take a look at how by reviewing this page:

A second option is to use SIPS (Scriptable Image Processing Server). Using SIPS with Enterprise requires that:

The Enterprise server be running on Mac OS X.
The SIPS Enterprise Server plugin is installed (available on the Community site and free).
SIPS was designed by Apple to provide tools for performing basic image alterations and support for various image formats. It is a OS level tool and support includes these image file types:

jpeg, tiff, png, gif, jp2, pict, bmp, qtif, psd, sqi, tga.

As you can see it doesn’t look like RAW files are supported here either.

That leaves the last ‘standard’ choice: ImageMagick

A quick review of this page clues me that all of the sample file formats (.NEF, .CR2 and .IIQ) are supported by ImageMagick

ImageMagick and RAW files

How are ‘RAW’ files supported by ImageMagick?

They are supported by using ‘ufraw’ (Unidentified Flying Raw) which is an open-source tool that allows for working with RAW files such as those from Canon, Nikon, Pentax, Samsung, Sony, Fuji and even Adobe. Here’s the web site:

Most installations of ImageMagick will probably NOT have ufraw so you will have to install it so that ImageMagick can work with it.

Installing ufraw…or in my case re-installing ImageMagick and then installing ufraw

In other parts of this web site you will find entries that refer to my Mac using MacPorts. I have installed PHP5/ImageMagick using this tool and find it easy to use. Keep in mind that you have to have ImageMagick installed if you are going to use ufraw with Enterprise.

To install ‘ufraw’ using MacPorts start ‘Terminal’ and enter:

sudo port install ufraw

Hit return and enter your password.

That should do the trick. Unless, of course, you are me. I had to do a variety of messing around with MacPorts that included uninstalling a series of unused port versions before I could finally get this installed.

Once MacPorts has worked its wonders you will be left with an installation that has ‘ufraw’ installed.

Enterprise and MIME Types

Out of the box Enterprise handles a LOT of file types. This is a case, however, where we have to add a MIME type to the system so that it can handle the files.

There are a variety of file types that are considered RAW files but for this example we are going to deal with three: .nef, .cr2 and .pef

Assuming you know how to work with Enterprise at the level where you can edit the configuration files take the following steps…assuming YOU HAVE MADE A BACKUP!

Open the configserver.php file and navigate to the section labeled ‘extensionmap’. Add the following line:

‘.nef’ => array( ‘image/x-nikon-nef’, ‘Image’),
‘.cr2’ => array( ‘image/x-canon-cr2’, ‘Image’),
‘.pef’ => array( ‘image/x-pef’, ‘Image’),

Be careful here and make sure that you follow the conventions laid out in the file. I.E. if you screw up the array your users will know very quickly.

Making these changes tells Enterprise that it can handle the indicated file extension, that the MIME type for the file extension is ‘image/xxx’ and that the file type will be a ‘Image’ when uploaded to Enterprise.

The Enterprise ImageMagick Server Plugin (which ships free with Enterprise)

Right now, with the MIME type added to configserver.php you can upload the RAW files to Enterprise and they will upload and be usable. The problem is that there will still not be a preview associated with the file.

We have to make a few changes in the plugin. We have to first change a file so that plugin recognizes that it can deal with our new MIME types. Then we have to change the code a bit so that a preview can be extracted from RAW files and uploaded to Enterprise.

Changing the ImageMagick_Preview.class.php file

To modify the plugin you will need to go your Enterprise installation to /server/plugins.

Open the directory labeled ‘ImageMagick’. Inside of that directory find the file labeled ‘Imagemagick_Preview.class.php’. Open this file with a text editor.

Find the area labeled ‘canHandleFormat’. This is a function that tells the plugin how to handle a variety of formats. Add the following:

case ‘image/x-nikon-nef’:
case ‘image/x-canon-cr2’:
case ‘image/x-pef’:

Save and close the file.

What would our results be at this point?

Right now, with the configuration that has been done up to this point and the installation of ufraw Enterprise will give you a 160 x 120 preview of uploaded images. Generally that’s not going to work for most uses as the preview is to small.

How can we get a larger preview? That is going to take a bit more work. This will include modifying the Enterprise ImageMagick server plugin a bit more.

Changing the ImageMagick.class.php file

The changes here are a bit…tricky.

What we have modify this code to look for a specific set of MIME types. If the MIME type is found we then have to process the file, extract the preview from the RAW file and write it to disc so that Enterprise can upload it.

It’s the extraction part that is a bit tricky. Enterprise/ImageMagick cannot extract the preview without the help of a program called exiv2.

The exiv2 tool is pretty cool in that it has a command that will pull the jpeg preview out of the RAW file and write it to disc. In general RAW files will contain up to 3 previews. One preview will be small, one medium and one large.

In the case of my sample file I have the following:

Preview 1: image/tiff, 160×120 pixels, 57600 bytes
Preview 2: image/jpeg, 570×375 pixels, 113163 bytes
Preview 3: image/jpeg, 4288×2848 pixels, 813532 bytes

Note: you can get the above output by entering the following into ‘Terminal’
exiv2 -pp /filename.extension
Once we have asked exiv2 to extract the preview we’ll need replace the preview that Enterprise extracted with preview exiv2 extracted.

Instead of laying out the code to do this here I will post it in WoodWing’s community forum

Testing preview generation

Make sure the ImageMagick Server plugin that you have modified is loaded by going to the Enterprise Admin area. Navigate to the ‘Server Plugins’ area and make sure that the ‘ImageMagick’ plugin is loaded.

Start up Content Station. Find a Dossier. Drag a .nef file (or other RAW file depending on your configuration) to the Dossier so that you get a upload dialog. Set the meta data and press ‘OK’.

The file will upload and a preview will be created.

Memory and large files
One thing about RAW files is that they can be quite large. Make sure that the setting PHP’s php.ini file are set correctly to allow Enterprise to upload files of this size. This should have been part of the initial configuration of Enterprise but check it anyway.

Mac OS X 10.6 – How to start Apache2 automatically when using MacPorts

One of the problems that people run into when installing Apache2/PHP when using MacPorts is a restart of the machine.

Restart? Why?

Using the instructions that I laid out doesn’t set up Apache2 to start up automatically when the machine is rebooted.

Now, I know…You could start Terminal, you can run ‘/opt/local/apache2/bin/apachectl -k start’

But…hey…we’re on a computer.

Here’s how to create a .command file that can be used a login item to start Apache2.

The idea is that we are going to create a text file and type a Terminal commmand that we want to execute.

We’ll then save it somewhere on the machine and turn it into a .command file. A .commmand file is a type of file that the Unix side of the Mac can execute.

Lastly we’ll go into the ‘Accounts’ area of the ‘System Preferences’ and make the .command file a startup item.

Create the file that will become the .command executable
Note: You could also use your favorite text editor to do this step.

Start the Terminal app
In Terminal type the following: pico startapache.command
What this does is start the command line text editor called ‘pico’ and create a file called ‘startapache.command’. A little more thought and you might enter: pico /Users/me/Documents/startapache.command
Type the following into the text editor: #!/bin/bash.
Note that this stops the command from pushing output.
Press the return key.
Type the following into the text editor: /opt/local/apache2/bin/apachectl -k start
Press ‘control-o’ to save the file
Press ‘control-x’ to close the file.
Make the file into a executable
We need to make the file we just created into a executable.

In Terminal type: chmod +x /Users/me/Documents/startapache.command (remember that ‘/Users/me/Documents/startapache.command’ is the path to file we created above. This WILL differ on your machine)
Press return
Make the file execute on startup.
One way of doing that is to go into your account and set the file as a login item. That is something that gets triggered as the User logs into their account. Another approach would be put the script into the ‘/Library/StartupItems/’ directory so that it fires when the machine boots. Your choice.

Open the ‘System Preferences’ application on your mac
Select ‘Accounts’
Select your account. You may need to enter the password.
Click on the ‘+’ sign at near the bottom left of the window
Select the file that you created above.
To test this you’ll need to restart the machine. If you added the script to your login items and didn’t select the ‘hide’ option you’ll see that the Terminal app starts, a window appears and the command is in the window.

Mac OS X 10.6, Apache2 and MacPorts – Restricting Directory Listings

In the MacPorts installation that I documented one of the things that is allowed out of the box is the ability of Apache2 to list the contents of a directory.

For instance, by default, if I enter in a url such as ‘’ I will get a listing similar to the picture below. Apache is listing the contents of the directories that don’t have an ‘index’ page.

Directory listing

To change this behavior you will need to open and edit the ‘httpd.conf’ file.

In my case I opened the file and looked for a Directory entry that looked like:

Directory “/opt/local/apache2/htdocs”

Inside of the directory will be something similar to:

Options Indexes FollowSymLinks
Change that line to this:

Options -Indexes FollowSymLinks
Restart the Apache2 server.

Enter the url again and you should get this:


Mac OS X 10.6 – MacPorts installs and Drupal

Enterprise works very nicely as a production CMS that users of the system can use to ship content such as articles, images, videos and audios to Web sites (and other destinations for that matter).

If you have been looking at any of the bits that I have put up regarding MacPorts on my Mac you have a pretty good idea that the following is true (at last on my machine):

1. Standard Apache2 that ships with Mac OS X 10.6 is not used by me
2. Apache/PHP is installed on my machine and the installation location is: /opt/local
The ‘htdocs’ directory is at /opt/local/apache2/htdocs’

The problem with my dev environment is that I could not get Drupal to work when installed into the /opt/local/apache2/htdocs directory.

The admin page would work but digging deeper into the site would result in nodes displaying only raw code.

Ugh. Ugly. I got around it by installing Drupal into the standard Mac location but I wanted to install Drupal into my ‘/opt/local/apache2/htdocs’ directory.

How to accomplish this?

After much digging around I found that adding the following directive to the httpd.conf file addresses the situation:

<Directory “/opt/local/apache2/htdocs/drupal”>
AllowOverride All
Options None
Order allow,deny
Allow from all
Drupal now works just fine.

Make sure to check your installation and settings for security, etc.






Mac OS X 10.6 – Setting up Apache 2.2 and SSL

Note that is part of another article that I have written. See here.

Mac OS X and SSL – Getting SSL running for Development purposes

Someone asked me the other day how to setup SSL on Mac OS X 10.6.

My answer: I have an idea but haven’t done it.

Here’s how I did it.

First of all, know that you need to have mod_ssl compiled with Apache 2.2 (in my case I have Apache/PHP installed via MacPorts. See here.) None of the steps below will be at all useful if mod_ssl is not installed.

Here are the resources that I used:

1. Apple write-up –

2. Macworld – Similiar to Apple write-up

There are two parts to this:

1. Creating the self-signed certificates and keys for mod_ssl and Apache to use

2. Configuring Apache to work with mod_ssl, the certificates and keys


Self-signed certificates


1. Create a directory on the Desktop called ‘KeyGen’

2. Start the Terminal application

3. In Terminal enter: cd ~/Desktop/KeyGen

4. The next step is to create a RSA Private key. The process will ask for a passphrase. During the process enter the passphrase and DON’T LOSE IT.

5. Create a RSA private key by using Terminal and entering: openssl genrsa -des3 -out server.key 1024

6. Create a Certificate Signing Request. This would normally go to a Certificate Authority.

In our case we are self-signing. The process of creating this request requires that you fill in information.

The most important bit of information to fill in is the ‘Common Name’.

This is the ‘Common Name’ of the server at THIS point in the process.

So, for instance, the ‘Common Name’ could be ‘’ or it could be ‘localhost’. Those are distinct and unique names. Pick one, use it and remember that you used it.

I selected ‘’.

7. To create the CSR enter into Terminal: openssl req -new -key server.key -out server.csr

8. Here’s the list of information that is requested:

Country Name (2 letter code) [AU]: (enter your country code here)

State or Province Name (full name) [Some-State]: (Enter your state here)

Locality Name (eg, city) []: (enter your city here)

Organization Name (eg, company) [Internet Widgits Pty Ltd]: (enter something here)

Organizational Unit Name (eg, section) []: (enter something here)

Common Name (eg, YOUR name) []: (this is the important one)

Email Address []: (your e-mail address)

Here is what I entered:

Country Name (2 letter code) [AU]:

USState or Province Name (full name) [Some-State]: MI

Locality Name (eg, city) []: Birmingham

Organization Name (eg, company) [Internet Widgits Pty Ltd]: My Company

Organizational Unit Name (eg, section) []: <<blank>>

Common Name (eg, YOUR name) []:

Email Address []:

9. Now we need to create the Certificate Authority that will then allow us to sign the key.

In Terminal enter:
openssl genrsa -des3 -out ca.key 1024

Enter in a passphrase. I used the same one from above. If you use something different remember it.

10. Time to create the self-signed CA Certificate. You’ll be using the RSA key you just made.

In Terminal enter:

openssl req -new -x509 -days 365 -key ca.key -out ca.crt

NOW…you’ll be asked for the passphrase and then you’ll be asked to fill in some information…just like above.

This one is a bit different. The Common Name this time will be YOUR name and NOT the server name/ip address.

Country Name (2 letter code) [AU]:US

State or Province Name (full name) [Some-State]:MI

Locality Name (eg, city) []:Birmingham

Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Company

Organizational Unit Name (eg, section) []:<<blank<>

Common Name (eg, YOUR name) []: My Name

Email Address []

11. Signing the server.key file with the ca.crt

As we have been progressing through the steps above files have been created in the directory we defined at the beginning of the steps…that is: ~/Desktop/KeyGen.

The next step is to sign the server.key with the ca.crt file.

We need a script to do this. That scripts name is ‘’.

The script MIGHT be on your machine but I doubt it. So you need to go get it.

In my case I downloaded the source for mod_ssl for Apache 1.3 (Here: Once the source was downloaded I looked into the following path: mod_ssl(version number)/pkg.contrib/

Copy the file into the ‘KeyGen’ directory on your desktop.

Run the following command. The first will make the file executable and the second will run the script and use the server.csr file.

In the Terminal App (don’t include the ‘Command 1:’ and ‘Command 2:’ text:

Command 1: chmod +x

Command 2: ./ server.csr

A bunch of information will start to appear in the Terminal window.

Enter in your passphrase.

Sign the certificate by pressing the ‘y’ key.

Commit the changes by pressing ‘y’ when asked to.


Setting up Apache 2.2


In the above steps we created the keys and certificates necessary for using SSL with Apache.

The following is a very simple set of steps to get things running.

NOTE: NONE of this setup is for a PRODUCTION server.

1. Move the contents of the KeyGen directory into a accessible location.

My local setup looks something like ‘/opt/local/’ with ‘/opt/local/etc’

What I did is create a directory called ‘httpd’ in the ‘etc’ directory. I then added another directory inside of that called ‘ssl_key’. So the final path to where I stored things is: ‘/opt/local/etc/httpd/ssl_key/’

Copy the contents of the ‘KeyGen’ directory into ‘/opt/local/etc/httpd/ssl_key/’

2. Edit the httpd.conf file
In my case I did two very simple things:

a. Since I compiled Apache with mod_ssl I had the following line in my httpd.conf file: Include conf/extra/httpd-ssl.conf

Uncomment that line by removing the # in front of it.

b. Navigate to the following path: /opt/local/apache2/conf/extra/httpd-ssl.conf

Apache needs to know where the SSL cert is. Find this line: SSLCertificateFile. The default will be something like: SSLCertificateFile “/opt/local/apache2/conf/server.crt.

Change the path to match the location of your server .crt file. In my case the path is something like:
SSLCertificateFile “/opt/local/etc/httpd/ssl_key/server.crt”

We need to tell Apache to listen for SSL connections. Add the following line under the listen command: Listen 443

c. SSL Session CacheLastly we need to tell SSL where to cache session information.

Look for this directive: Inter-Process Session Cache

Change this line ‘SSLSessionCache “dbm:/opt/local/apache2/logs/ssl_scache” so that it is NOT commented out.




1. Starting and Stopping Apache2

a. Start: /opt/local/apache2/bin/apachectl -k start

b. Stop: /opt/local/apache2/bin/apachectl -k stop

c. Restart: /opt/local/apache2/bin/apachectl -k restart

2. Where to look for errors:Apache will log errors into the ‘error_log’ file located at ‘/opt/local/logs/apache2/error_log’

The only error that I ran into was this one: Invalid method in request

It had to do with the way that I had the .conf file setup. If you get that error take a look at the .conf files.

3. Hitting the server

a. After you have made your .conf file changes restart the server

b. Go to a browser and type in:

c. You’ll get a request about the cert. Press ok.

d. You should see in the browser a little lock indicating that the browser is running in secure mode.


Mac OS X 10.6 – Installing ImageMagick and Ghostscript using Macports

Here is a bit information that I use in conjunction with my previous article about how to install Apache/PHP/MySQL using MacPorts. Remember to do the steps in the article noted above first.

In addition this post includes a bit of information on doing a brute force change to the ImageMagick plugin for Enterprise to get it to work with this combination. I should really just change the code but haven’t gotten around to that yet.

NOTE: There is one thing to keep in mind here. If you are using Enterprise and running the Server on Mac OS X for Production you should consider the SIPS plugin instead of ImageMagick.

ImageMagick and Ghostscript installation steps

Run the MacPorts ImageMagick install

sudo port install imagemagick

Run the MacPorts Ghostscript Install

sudo port install ghostscript

Once done these applications are installed at: /opt/local. This is IMPORTANT!

That’s all there is for installing ImageMagick and Ghostscript

If you want the ImageMagick plugin to work with this installation make the changes below. Remember that is my brute force method.

The ImageMagick Enterprise server plugin

Go to the ImageMagick Server Plugin located at: /server/plugins/ImageMagick

1. Open ‘ImageMagick.class.php

2. Find the line of code: self::setEnvironment();

3. Comment each line out. Should look like: //self::setEnvironment();

4. Find the function: getVersions().

5. In the function getVersions find the line: $output1 = shell_exec( “convert -version)

6. Change it to: $output1 = shell_exec( “/opt/local/bin/convert -version” );

7. Save.

8. Find the function: convertFile.

9. Comment out the line: $cmdline = “convert”;

10. Add the line: $cmdline = “/opt/local/bin/convert”

11. Go to the Admin area in your browser. Login and go to the Server Plugin page. Turn on the ImageMagick Server Plugin.


Mac OS X 10.6 – Installing Apache2/PHP/MySQL using MacPorts

This article will be broken down into the following:

1. Install Apache2/PHP5 using MacPorts (this article)

2. Install ImageMagick and GhostScript (see article here.)

3. Install Tomcat and Solr

4. Get the Apache2/PHP5 setup working with Komodo.

5. SSL and Apache (see article here)


Steps for installing Apache2/PHP5 + MySQL on a Snow Leopard machine using MacPorts.


In my job I do a lot of different things. Mostly software demonstrations but a bit of development here and there as well. The server part of the system that our company sells is built to run on Apache(or IIS), PHP and MySQL(or SQL Server or Oracle).

When Snow Leopard came out I was faced with a set of problems:

1. I needed Apache/PHP/MySQL installed on my machine

Well, you might ask, Mac OS X comes with all that goodness pre-installed doesn’t it?

The answer to that question is yes…but…there are some other conditions that need to be met:


a. The Apple-compiled versions of the software may not meet my needs either through the version installed or through, in the case of PHP, the additional modules that our application requires.

b. Apple updates to Mac OS X can and probably will blow out any changes that I might make to the stock build. That’s not good. I like to update my software.


What about using MAMP?

MAMP is a nice choice for development. Download, install and start. Easy. However, I don’t want to use MAMP if the machine is going to be used for Production. In my case I want to replicate the production environment as closely as possible.

So, how do we go about installing new builds of Apache2, PHP5.3 with MySQL support and all the PHP extension we need?

Use MacPorts.

There are 3 steps involved here:

1. Download and install the latest version of XCode

2. Download and install MacPorts

3. Use MacPorts to install the stuff we need.


Download and install the latest version of XCode


Note that this takes a bit of space on your machine.

This step cannot be avoided.

What is happening is that by installing XCode we are getting access to the compiler that MacPorts needs to be able to compile the stuff (Apache2, PHP, etc…) we are going to be installing.

1. Go to

2. Download the latest version of XCode (comes as .dmg file that is quite large)

3. Install XCode by opening the .dmg file and running the installer. You don’t need to change any of the options that are selected.


Download and install MacPorts


1. Go to the MacPorts web site and download the latest MacPorts installer (a .dmg file) for Snow Leopard.

The web site address is:

There is a key point to note in the instructions. That is the point about the ‘selfupdate’ command. This command keeps the list of ‘portfiles’ on your machine up to date with the list of current ‘ports’ available.

After the installer is done go ahead and finish the installation.

Start the ‘Terminal’ application and type in:

sudo port -v selfupdate.

Press return. A request to enter a password will appear. Keep in mind that the ‘sudo’ command is overriding your standard privileges and allowing the Terminal command to act with your Administrator privileges.

MacPorts will update itself. Note that it writes out what it is doing in the Terminal window.


Install PHP5


In this step we are going to tell MacPorts to install PHP5 (at the time of this writing the version of PHP available via MacPorts is 5.3.2). This command will also install any dependencies that PHP5 needs. That includes, in this case, Apache2.

MacPorts will install, by default, into the /opt directory. That directory will be created at the root of your hard disk.

When you are ready enter the following commands into the Terminal window.


1. Each command is telling MacPorts to go out to a Internet location, download the necessary files to compile the app or extension and then perform the compile and install the app. Hence Internet access is required

2. Each command will list out what it is doing as it performs each step. Pay attention! Watch for errors.

3. It take some time to download and compile this stuff. Don’t get impatient.


Initial Terminal command to install PHP5


sudo port install php5


Install php5 MySQL support


sudo port install php5-mysql

sudo port install php5-sqlite


Install php5 support for other stuff. Your needs may vary.


sudo port install php5-sockets

sudo port install php5-mcrypt

sudo port install php5-mbstring

sudo port install php5-imagick

sudo port install php5-xdebug

sudo port install php5-xmlrpc

sudo port install php5-xsl

sudo port install php5-zip

sudo port install php5-soap

sudo port install php5-gd

sudo port install php5-exif

sudo port install php5-openssl

sudo port install php5-iconv


Mac OS X 10.5 – Installing the latest version ImageMagick and Ghostscript using MacPorts

The caveat with this post is….I assume you know what the heck you are doing…

Download and install MacPorts

  1. Go to here:
  2. Download the Leopard (Universal) .dmg file
  3. Open the .dmg file and run the installer package.

MacPorts is command line application. There will not be any application installed directly into the /Applications directory

Make one modification to the MacPort config scripts

Macports installs itself into a directory called /opt and places a configuration file at this location: /opt/local/etc/macports/macports.conf

To make sure that both GhostScript and ImageMagick install into the correct directory so that Apache and PHP can use the applications we need to change this configuration file. Use either TextWrangler or Pico(terminal) to open this file.

Find the section of the file labeled:

# Set the directory in which to install ports
prefix /opt/local

Modify the file so that it reads:

# Set the directory in which to install ports
prefix /usr/local

Save and close the file.

Install ImageMagick

  1. Start Terminal
  2. Type into the terminal window: sudo port install ImageMagick
  3. MacPorts will grab the necessary pieces and compile, build and install ImageMagick into the following directory: /usr/local/

That’s it.

Install Ghostscript

  1. Start Terminal
  2. Type into the terminal window: suod port install ghostscript
  3. MacPorts will grab the necessary pieces and install ghostscript into the following directory: /usr/local/