Skip to Main Content

go to Indiana University Indiana University


Archive for the 'Macintosh Skills' Category

PHP Workshops: Install and Use PHP Locally

To develop database-driven PHP applications, we need three things, the Apache web server, the PHP processor, and MySQL. This tutorial will walk you through all of the installation and setup that you need to do on your own machine to have a local instance of a Apache/MySQL/PHP (AMP) environment.

The instructions below will walk you through the setup you need for each of our PHP workshops, starting with PHP: The Basics.

At the time of writing, PHP: The Basics is the only PHP workshop offered by IT Training.

PHP: The Basics

The following links contain step-by-step instructions on configuring XAMP for the PHP: The Basics workshop.

Macintosh OS: Install and Configure MAMP for PHP Development

If you are planning on developing PHP applications on Mac OS X, you’re in luck! Most of the tools come built-in to the operating system; all we need to do is activate them.

This tutorial is written for the most recent (at time of writing) version of Mac OS X, 10.8 Lion. The instructions listed here will work on most of the recent versions of Mac OS X. If you need help with another OS version, leave a comment on this post.

This instruction set is also focused primarily on the setup needed to complete PHP: The Basics. Specifically, this post will not detail what needs to be done to set up MySQL and phpMyAdmin to administer a MySQL database. Instructions for that topic will be included in another post.

Configuring Apache for Mac OS X 10.8 Lion

Let’s start with Apache, the web server. This is built in to the operating system, but it’s not accessible by any of the graphical interfaces available. Let’s begin by launching Terminal.

  1. To launch Terminal,
    Press Command – Space,
    Type Terminal,
    Press Return

    This will launch Terminal to your home directory:

  2. To start Apache, type: sudo apachectl start
    Press Return

    Apache will start.

Other Useful Apache Commands

Now that Apache has started, let’s take a moment to review some other useful Terminal commands for Apache.

  • sudo apachectl stop — stops the Apache service
  • sudo apachectl graceful — restarts the Apache service
  • httpd -v — shows the current version of Apache (Apache 2.2.22 comes installed with Mac OS X 10.8 Lion)

These commands will be useful throughout your time working with apache. Let’s test that Apache has started.

  1. To see if Apache has started,
    Launch a Web Browser,
    In the Address bar, type: localhost,
    Press Return

    If apache has started, you should see a web page that says “It works!

    By default, this will make your document root be /Library/WebServer/Documents. When we navigate to http://localhost, the files in this directory are displayed. This is not a good place to do our work since it’s in the root level of the operating system. We will create a folder inside our own user directory that will contain all of our sites. This will be referred as User Root.

    To begin this process, let’s set up a folder called Sites in our user directory.

  2. To make the appropriate directory, in Therminal, type:
    mkdir /Users/username/Sites

    Where username is replaced with the short username of your account. If you do not know your short username, in Terminal, type: whoami and press return.Now that we have a User Root directory for all of our sites, let’s tell Apache where to find them. To do this, we need to create a file called username.conf and add some XML to that file.

  3. To create username.conf, in terminal, type:
    sudo nano /etc/apache2/users/username.conf

    Replacing username with your short username.The nano editor launches with a new file called username.conf. This is where we will add our XML.

  4. To add the XML needed to configure the User Root, type:
    <Directory "/Users/username/Sites/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>

    Again, replacing username with your short username.

  5. To save the file, press:
    Ctrl – O, Return, Ctrl – X

    Before we are finished, let’s make sure the file has the correct permissions.

  6. To change the permissions of the file, in Terminal, type:

    sudo chmod 644 /etc/apache2/users/username.conf

    Replacing username with your short username.

    Apache is now configured to look in /Users/username/Sites when we browse to http://localhost/~username. Let’s restart Apache and configure PHP.

  7. To restart apache, in Terminal, type:
    sudo apachectl graceful

Configuring PHP

Now that Apache is running, we need to start PHP. This is done by uncommenting a line in the Apache configuration file located at /etc/apache2/httpd.conf. Let’s do that now.

  1. To open the httpd.conf file, in Terminal, type:
    sudo nano /etc/apache2/httpd.conf
    Press Return

    Now, we will use nano’s built-in search functionality to find the line that talks about PHP.

  2. To search for PHP, in nano, type:
    Ctrl – W, php, Return

    This will locate the apropriate line.

  3. To uncomment the line,
    Remove the octothorp (#) from the beginning of the line

  4. To save the file and continue, press:
    Ctrl – O, Return, Ctrl – X

    Now that the line is uncommented, let’s restart Apache to have the changes take affect.

  5. To restart Apache, in Terminal, type:
    sudo apachectl graceful
    Press Return

Testing PHP

Now that we have PHP configured, let’s test the installation by creating a php document that contains the phpinfo(); function in our User Root directory.

  1. To create the PHP information file, in Terminal, type:
    nano /Users/username/Sites/phpinfo.php
    Press Return

    Again, replace username with your short username.

    This will create the file, now let’s add the code.

  2. To add the PHP code, type:
    <?php phpinfo(); ?>
  3. To save the file, press:
    Ctrl – O, Return, Ctrl – X

    This saves the file. We are now ready to test the connection.

  4. To test the PHP configuration, in a Web Browser, navigate to:
    http://localhost/~username/phpinfo.php

    You should now see the PHP installation information.

This concludes what is needed to move through PHP: The Basics in self-study mode. The last bit of information here is a list of recommendations on how to set up your Sites folder to complete the workshop.

  • Create a sub-folder in your User Root directory named PHPBA. This will be the Local Site Folder when configuring your site in Dreamweaver.
  • Since you are working on your local machine, you do not have to upload files using the Ctrl – Shift – U keyboard shortcut in Dreamweaver. Simply save and refresh the web browser.
  • To make sure all of your exercise files are ready to go, place the contents of the PHPBA folder in your newly created PHPBA folder inside your User Root directory.

That’s it! Happy PHP’ing!

Understanding Mac Keyboard Shortcuts

Apple has made a lot of changes to the behavior of their keyboard shortcuts over the last several operating systems. In the days before Exposé, things were pretty straightforward; the function keys worked the same regardless of how the operating system was configured.

Today, with Mission Control and Exposé, things aren’t so easy. Apple keyboards now have fancy little icons on some of the F-keys, and by default, they don’t function like a windows F-key. This can be confusing and it makes it difficult for us to keep our materials accurate for Macintosh systems.

Read the rest of “Understanding Mac Keyboard Shortcuts” »

You want fries with that MacRibbon?

So it’s official now, a ribbon is coming to the upcoming Office for Mac 2011.

This ribbon will combine features located in the Formatting Palette and the Elements Gallery. But don’t freak out, because the menu bar and the standard toolbar will still exist.

Wanna catch a glimpse of the new interface? See the rest of this post…
Read the rest of “You want fries with that MacRibbon?” »

Extending STEPS with lynda.com – Use Photoshop blend modes for color and contrast correction

You may already know that Photoshop blend modes can immeasurably enhance your creativity and playfulness. You may be familiar with the artful aspects of blend modes; however, most Photoshop users don’t know they are corrective, too. Understanding how they work is a key to using them to your best advantage.

Read the rest of “Extending STEPS with lynda.com – Use Photoshop blend modes for color and contrast correction” »

Extending STEPS with lynda.com – Illustrator CS4 Essential Training

You may have attended the IT Training & Education STEPS workshop, “Adobe Illustrator CS4: The Basics,” and would like to learn more. Make lynda.com your personal trainer! If you would like a little review of Illustrator followed by more advanced concepts, see Mordy Golding’s Illustrator CS4 Essential Training.

Read the rest of “Extending STEPS with lynda.com — Illustrator CS4 Essential Training” »

Extending STEPS with lynda.com – PowerPoint 2008 for Mac Essential Training

In an earlier blog post, Veronica discusses the lynda.com training that is available for Office for the Macintosh. I was happy to see that she was sharing this information, because participants who attend the IT Training & Education PowerPoint workshops almost always have questions about PowerPoint for Mac versus PowerPoint for Windows. Is the interface exactly the same in the two applications? Do they use the same filename extensions? Can I open up and edit a Mac presentation with the Windows version? Etc., etc…

Since IU students, staff, and faculty can now access lynda.com for free, it is a great time to learn more about PowerPoint for the Mac. In David Rivers’ tutorial called PowerPoint 2008 for Mac Essential Training, you can find out everything there is to know about the Mac version of this application, including how to:

  • create, edit, and share professional slideshows and presentations
  • efficiently navigate presentations
  • apply custom themes
  • place and edit text, images, and multimedia files
  • publish a self-running or manual slideshow

Mac users can watch all of the modules included in this comprehensive tutorial, or they can just watch the sections they are most interested in. If you have already attended our STEPS PowerPoint workshops, you may just want to view the section called Understanding the Interface.

lynda ppt

If you haven’t yet taken any of the STEPS workshops in this series, consider attending one of the following:

  1. PowerPoint: The Basics
  2. PowerPoint: Enhancing & Packaging a Presentation
  3. PowerPoint: Customizing a Presentation
  4. PowerPoint: Project Lab 

This is the last official blog article in the lynda.com series, but you can bet that there will be more information about this fantastic learning resource in upcoming posts.

Get Training Tips via RSS Subscribe to Entries feed or Read Comments via RSS Subscribe to Comments feed.