XAMMP - Apache/MySQL/PHP5/Perl

From AwkwardTV
Revision as of 12:08, 16 March 2008 by Fcorthay (talk | contribs) (Enabling using the AppleTV installation)
Jump to: navigation, search

XAMPP is a simple, most practical and most complete webserver solution. The XAMPP for OS X distribution provides an Apache 2 web server, integrated with the latest builds of MySQL, PHP (both 4 and 5) and Perl. It requires no dependencies.

If you are an experienced web developer or a Mac enthusiast who needs to run a webserver, create dynamic webpages or use databases, this is your lucky day!

Prerequisites

XAMPP package

The XAMPP package can be downloaded from their website. Choose the tar version.

Unzip binaries

Unzip binaries will be used on your AppleTV to extract the XAMPP package.

  • Download the binary Darwin for Intel distribution from the Opensource pages.
    This contains many useful files.
  • Untar the file (Double click in Mac OS X)
  • Mount the disk image (Double click in Mac OS X)
  • In the Terminal:
scp /Volumes/Darwin8_i386/usr/bin/zip frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/unzip frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/gzip frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/gunzip frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/bzip2 frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/bunzip2 frontrow@AppleTV.local:/Users/frontrow/Documents
ssh frontrow@AppleTV.local
sudo -s
mount -uw /
mv /Users/frontrow/Documents/* /usr/bin/
chown root:wheel /usr/bin/*

Installing XAMPP on the Apple TV

To Install the XAMPP package on the Apple TV follow this steps :

On your Mac

  • Copy the .tar.gz file to your Apple TV (the way you prefer, AFP, SCP, etc...).
    Fugu provides a graphical interface for this purpose.
  • Open a SSH connection to your Apple TV.

On the AppleTV

  • Navigate to the download folder
  • Get the required priviliges:
sudo -s
mount -uw /
  • Extract the downloaded file:
tar -xvzpf xampp-macosx-0.7.2.tar.gz -C /
  • Start your XAMPP:
/Applications/xampp/xamppfiles/mampp start

You should see the following:

Starting XAMPP for MacOS X 0.7.2...
XAMPP: File permissions are being checked... this may take a while.
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for MacOS X started.
  • Try your installation with the link http://AppleTV.local and choose a language.
    Tip - If you get PHP errors, it's because you didn't extract it with the 'p' parameters. Re-extract it with the exact command.
  • Assuming it's working, it's time to secure your XAMPP installation.
/Applications/xampp/xamppfiles/mampp security

Tip - If you give an SQL root password, the demos won't work any more.

Configuring Apache

Find the Apache configuration file:

find /Applications/xampp/ -iname httpd.conf

Mine is /Applications/xampp/etc/httpd.conf

Find the location of the web pages:

cat /Applications/xampp/etc/httpd.conf | grep ^ServerRoot

Mine is /Applications/xampp/xamppfiles/htdocs/

You can modify the location of the web pages in httpd.conf and put your files at the proper location.

Enabling at boot time

Enabling the Apple way

Apple provides a page on how to create a Startup Item.

Enabling using the AppleTV installation

The AppleTV already ships with an Apache startup file: </code>/System/Library/StartupItems/Apache/Apache</code>

  • If not done already, get the required privileges:
sudo -s
mount -uw /

Edit file: /System/Library/StartupItems/Apache/Apache

  • ensure disk is writeable: mount uw /
  • set new hostname (optional - If you want to change AppleTV.local to something else): scutil --set ComputerName NewName
  • set new hostname (optional - If you want to change AppleTV.local to something else): scutil --set LocalHostName NewName
  • replace apachectl with mampp details

Edit file: /etc/hostconfig replace WEBSERVER=-NO- with WEBSERVER=-YES-

Enabling with the help of AFP

Assuming you have enabled AFP (AppleShare) to start at boot, you can add the line:

/Applications/xampp/xamppfiles/mampp start

To the file /System/Library/StartupItems/AppleShare/AppleShare after the If statement in the StartService function, and then XAMPP will startup at boot time.

Adding XAMPP to the AppleShare startup item is not recommended.