Installing PHPture 2.0 on Mac OS X 10.5
1. Setting up the web server
PHPture allows you to view your library in a web browser. In order for it to work you need to set up a web server that can serve the pages to the browser.
Mac OS X 10.5 comes bundled with Apache web server and PHP5, so unlike in previous versions there is no need for you to install it. Unfortunately, PHP is not enabled by default, so you have to do that first.
One way to enable PHP is by opening the Terminal application and enter the following command (you can copy and paste it):
sudo nano /private/etc/apache2/httpd.conf
Press [Enter], you will then be asked to give your password, if you enter it correctly you can now edit the configuration file httpd.conf. Keep pressing the [arrow down] key until you find a line starting with #LoadModule php5_module... (it's near the end of the LoadModule list) remove the # at the beginning of the line using [backspace/delete] and then press the keys [Ctrl] + [X] to exit the Nano text editor, (yes [Crtl], not the [Command]/[Apple key]!) and then press [Y] to save and press [Enter] to overwrite the current file.
The next thing that you need to do is go to the System Preferences and select the Sharing panel. In the list select Web Sharing and turn it on. If it is already running you still need to turn it off and on again, so that it will load the configuration file that you just changed.
Click on the address that is shown on the bottom in your browser to test if the web server is running, if it is, you should see a page with the text '
Your website here'.
If you want to allow other computers to access PHPture on the network go to the Security panel and click on the Firewall tab and make sure that you allow incoming connections for Web Sharing.
Please note if you are directly connected to the internet your library will also be available for others! Please refer to the Apache documentation on how to require authentication for users. If you have a router or a server with a firewall in your local network your library will only be accessible from inside your own network.
2. Configuring Apple Aperture
Open up Apple Aperture 2 and go the the Preferences window (in the Aperture menu, or press [Command] + [,]).
The first panel has the option 'Library Location' on top, and has the path and name of your Aperture Library as its value. If this is the library that you want to share using PHPture, remember the location (or copy it to your clipboard), you will need it in the following steps.
Go to the panel labelled Previews and check the option
New projects automatically generate previews. Any other options are not relevant to using PHPture.
In Finder, go to your home-directory and open the directory 'Sites', this is where the test page for the web server that you saw earlier in your browser is located.
If you haven't downloaded PHPture yet, do so now and unzip it to the directory named Sites.
Open the configuration file conf.php in a text editor and replace the default location of the library with your own (line 25).
Make sure that your location does not start with ~ (tilde). If so, replace it by Users/ followed your username, just like in the example.
If your username is 'Johnny' and the library is located in the Pictures directory ~/Pictures/Aperture Library.aplibrary will have to be changed into /Users/Johnny/Pictures/Aperture Library.aplibrary.
The next thing you have to do is make the Aperture Library readable for the web server.
If your library is located in your Pictures directory you can simply run the file install.command that is in the same directory as the other PHPture files. This will open the terminal Application and does two chmod operations. Not that the Terminal application needs to be closed, otherwise it will not open when you try to run the script.
After the script has run you are done and can open PHPture in your browser.
Optional manual configuration
If you want to use the Aperture Library at another location you need to make it readable manually. Open up the Terminal application and navigate to the directory that the library is in using the cd command like this:
If the path contains spaces, surround it with double quotes ("), use the [Tab] key for auto completion of directory names.
To make the directory readable, type the following and press enter to execute:
chmod o+rX .
Them make the Aperture Library and all files contained in it readable, yours may have another name:
chmod -R o+rX "Aperture Library.aplibrary"
And that is it, open up your browser and see if it works.
If you have a previous version of PHPture installed, just overwrite all files, including the configuration file. After copying the files update the configuration file with your own settings.
Accessing PHPture is similar to visiting a website, open up a web browser and enter the address http://127.0.0.1/~Johnny/phpture where 'Johnny' is replaced with your own username.
127.0.0.1 is always the IP-address of the current computer. Alternatively you can also use the address http://localhost/~Johnny/phpture/d even use the name of your computer as the hostname, this one is displayed in the Sharing panel in System preferences.
Please note the last / (slash) in the address, if you leave it out things might not work.
3. Configuration Tips
If you try to open an file by double clicking on it in Finder the files the address will be something like file:///Users/Johnny/Sites/phpture/index.php and the files will not be parsed by PHP, and you will see the PHP-code instead.
By changing the document root of Apache by editing the file httpd.conf you can get an even shorter URL like http://localhost/phpture.
When trying to access PHPture from another computer in your network you should use its IP-address. On Mac OS X you can see your IP-address in the application Network Utility. Please note that a single computer can have multiple network interfaces (ethernet, wireless, bluetooth, firewire) which all have a different IP-address in your local network. The URL will then be something like http://192.168.1.2/~yourname/phpture/ for others who want to access your library.
To access your library over the internet you will probably need to give your computer a static IP address and configure your router to do some port forwarding, how this can be done is beyond the scope of this manual, these instructions should help you look in the right direction for more detailed answers. Please remember that if you can access something over the internet, other people can do so too. The Apache web server in Mac OS X allows for basic authentication using a .htpasswd file which can help you protect your files from unwanted access.
Should you have any problems getting PHPture to work, you can find help at the PHPture Forums @ SourceForge. Try opening the page http://127.0.0.1/~yourname/phpture/debug.php in your browser and include the information from that page to your help request.