WordPress 2.6 and EXIF Extraction

I’ve been having this problem for a better part of almost two weeks now. I finally figured out the solution to the problem. With WordPress 2.6, one of the new built in features is the ability to extract EXIF data from a JPEG, store it in the database, and allow you to make a call for it. This is to complement the new built in gallery feature that was introduced in WordPress 2.5. Continue reading WordPress 2.6 and EXIF Extraction

MAMP: Mac, Apache, MySQL, PHP

Introduction

Before my friend introduced me to MAMP (Mac + Apache + MySQL + PHP), I wasn’t really able to do much web producing commuting to work. I was limited to making site mockups using Adobe Photoshop CS2 and some basic coding, but I couldn’t actually make the pages until I had internet connection so I could upload my test site to the sandbox.

Then came along MAMP, an all-in-one application for Mac OS X that allows you to locally host a web server! This was fantastic because now I can develop, hard code, check changes, and make all the changes I want without having an internet connection. It also lets me test run PHP codes or scripts that may be unstable and vulnerable without risking the web server.

How To Install

Installing and configuring MAMP is very, very easy.

  1. Download the latest copy of MAMP from the MAMP website. After it is done downloading, double click the downloaded file to unzip the contents.
  2. Drag the MAMP folder into the Applications folder.
    MAMP Install 02
  3. Once MAMP has completed copying into the Applications folder, you can find the executable at Applications>MAMP>MAMP.
    MAMP Install 03
  4. When you start it up, you’ll notice two things will appear: (1) the MAMP admin panel and (2) http://localhost:8888/MAMP/?language=English loaded into your default web browser.
  5. From the admin panel you can stop and start the Apache and MySQL servers.
    MAMP Install 04
  6. Your default web url is http://localhost:8888/ and your public folder is located (by default) at Applications>MAMP>htdocs. So anything that is placed within the htdocs folder will appear at http://localhost:8888/. Please note that this web address is local only and others will not be able to see it or the contents even if your computer is connected to the internet. I’ve seen where some people have mistakingly thought that MAMP can be used as a live web server. No, this was only designed to allow people to work locally.
  7. To change the default location of what folder will be the web folder, in MAMP, go to the menu bar and select Preferences and then select the Apache tab. Enter or select a new location.
    MAMP Install 05

Mac OS X: Setting Up Apache, MySQL, PHP and Mod_Rewrite

Please note that I did not write this. This is reprinted from TextDrive written by SuperJared. The only thing that has been changed is formating, all else is exactly as the author written. This is here for my personal reference.

Step 1: Enable Apache.

Go to System Preferences > Sharing and enable Personal Web Sharing. Verify that Apache has started by opening a browser and pointing it to http://localhost/.

Step 2: Install MySQL.

This is almost as easy as enabling Apache since MySQL has excellent support for Mac OS X.

Go to http://dev.mysql.com/downloads/ and pick out the latest OS X flavored package. Make sure to get the right one for your architecture. Mount the dmg and you should see two installer packages: one for the MySQL database, and the other installs the MySQL startup item.

The easiest thing to do is just run the standard installer for the database. It should be called something like mysql-standard-VERSION-apple-ETC.pkg. After that is installed, install the file MySQL.prefPane by double-clicking it. This is a panel in the System Preferences that allows you to start, stop and configure the database for automatic start.

Your database is installed. Look into the MySQL documentation if you want to secure it, because right now, the user name is root and there is no password.

Step 3: Install PHP.

Go to http://www.php.net/downloads.php and download the latest source version. You’ll want to put this in your directory (that’s my preference, at least), so open up a terminal:

cd /usr/local/src/ sudo fetch http://path/to/the/latest/download/from/php.net/ sudo tar zxvf php-VERSION-ETC.tar.gz cd php-VERSION

At this point you’re in the PHP source directory. We’ll now configure our PHP. NOTE: This example has the bare minimum of options to get this all working properly. See the PHP documentation for more configure options.

sudo make sudo make install sudo cp php.ini-dist /usr/local/lib/php.ini

Make sure to edit to your desired settings. Now we need to edit httpd.conf:

sudo open -a TextEdit /etc/httpd/httpd.conf

And make sure these lines are in their proper locations:

LoadModule php5_module libexec/libphp5.so # Should have been added already AddModule mod_php5.c # Should have been added already AddType application/x-httpd-php .php

Now restart Apache:

sudo apachectl graceful

And verify that the install worked by creating a file called test.php under your Sites directory (/Users/myusername/Sites/) with the following text:

<?php phpinfo(); ?>

Go to http://localhost/~myusername/test.php to verify that it worked.

Step 4: Enable mod_rewrite. (Optional)

Enabling mod_rewrite requires additional modification of the httpd.conf (and related) files so we can use .htaccess files.

sudo open -a TextEdit /etc/httpd/httpd.conf

Under this line:

<Directory "/Library/WebServer/Documents">

You’ll see:

AllowOverride None

Change this to:

AllowOverride All

You’ll also want to modify your user’s configuration file:

sudo open -a TextEdit /etc/httpd/users/myusername.conf

The Options directive must include FollowSymLinks, and the AllowOverride should be AuthConfig All. Example:

<Directory "/Users/myusername/Sites/"> Options Indexes MultiViews FollowSymLinks AllowOverride AuthConfig All Order allow,deny Allow from all </Directory>

Restart Apache and you’ll be able to use .htaccess files.