Apache

From Applepedia

Jump to: navigation, search

With most recent copies of Mac OS X, Apache is installed, allowing users to run their own webserver from their Mac. With OS X 10.3.8, Apache 1.3.3 is present.

To enable Personal Web Sharing, Check the box next to "Personal Web Sharing" in the Sharing tab in your System Preferences. From there, /Library/WebServer/Documents/ is the root folder for your web pages. You’re done — your page is ready for viewing. Make sure you have someone handy to exchange high fives with. If you want to use PHP, keep reading.

Note: Users trying to access files you have put into /Library/WebServer/Documents/ may get HTTP 403 Errors. Open Terminal, and type in:

 sudo chmod 644 /Library/WebServer/Documents/*.* 

Contents

Enabling Scripting Languages

Mac OS X also comes with Perl, PHP, Python and Ruby scripting languages. However none are enabled for use with Apache.

Enable PHP

Tiger comes with PHP version 4.3.10

  1. Edit /etc/httpd/httpd.conf. Note: If doing this from the Terminal, use sudo. sudo pico /etc/httpd/httpd.conf
  2. Find the following line and delete the # so as to uncomment the line: #LoadModule php4_module libexec/httpd/libphp4.so
  3. Now find the following line and again, remove the # to uncomment the line #AddModule mod_php4.c
  4. Save the file
  5. Restart Apache by one of the following methods.
    • At the command line: sudo apachectl restart
    • Or you can open System Preferences, then Sharing, then stop and start the Personal Web Sharing service.

The configuration you get

'/SourceCache/apache_mod_php/apache_mod_php-17/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '
--infodir=/usr/share/info' '--with-apxs' '--with-ldap=/usr' '--with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '
--enable-trans-sid' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-dbx' '
--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--with-config-file-path=/etc' '--sysconfdir=/private/etc'

Alternative: Install PHP5

If you want PHP5 or you're too lazy to enable PHP using the above method, you can use this binary installer: PHP Apache Module by Marc Liyanage

Enable Perl

Tiger comes with Perl 5.8.6

  1. Edit /etc/httpd/httpd.conf. Note: If doing this from the Terminal, use sudo. sudo pico /etc/httpd/httpd.conf
  2. Find the following line and change it from this: Options Indexes FollowSymLinks MultiViews
    To look like this: Options ExecCGI Indexes FollowSymLinks MultiViews
  3. Now find the following line, and remove the # to uncomment the line: #AddHandler cgi-script .cgi (you may also change .cgi at the end to .pl, if you prefer.
  4. Save the file
  5. Restart Apache by one of the following methods.
    • At the command line: sudo apachectl restart
    • Or you can open System Preferences, then Sharing, then stop and start the Personal Web Sharing service.

About Apache

Apache is, in a nutshell, a continually evolving hunk of server software that’s both free and priceless at the same time. One of the absolute gems to emerge out of the open source movement, Apache is free in the sense that it’s not proprietary. Programmers essentially have the freedom to do what they want with the source code once they have it — provided they pass along to other programmers the same rights and privileges to change and modify the source code that they themselves had when they first got their mitts on it.

Powered by OS X

Image:PoweredByMacOSX.gif

Image:PoweredByMacOSXLarge.gif

Personal tools