Welcome to SpinnerWorld
Sponsored links:




menu image
menu imageTip of the daymenu image
menu image
menu imageWeb Spinning Resourcesmenu image
menu image
menu imageWeb Spinning Softwaremenu image
menu image
menu imageMapSinnermenu image
menu image
menu imageCamSpinnermenu image
menu image
menu imageMailSpinnermenu image
menu image
menu imagemenu imagemenu image
menu image
menu imageSoundSpinnermenu image
menu image
menu imageSpinnerWorld Home Pagemenu image
menu image

Optima System







Enabling PHP in OS X 10.2, 10.3 and 10.4

Mac OS X is the perfect environment for developing PHP pages. The popular Apache Web server is a part of the system and the PHP server extension for Apache is included in OS X 10.2 and higher. This makes it relatively easy to setup Personal Web Sharing and enabling PHP to develop PHP files locally on your Mac.

The Personal Web Sharing is powered by the OS X Apache Web server and you can enable Web sharing in the System’s Sharing Preference panel. PHP is however by default disabled in the standard setup.

This page describes how to activate PHP in the Mac OS X 10.2 to 10.4 using PageSpinner’s OS X Tools. PageSpinner also offers support for PHP with PHP syntax coloring, a new PHP menu and a Lookup PHP function. See this page for info on how to enable PHP in OS X 10.5/10.6.

Before you start working with PHP it is highly recommendable to set PageSpinner to use Unix line feeds whan saving the files. This will let you find any errors reported by the PHP engine using PageSpinner's Go To Line... command. You can set the PageSpinner to use Unix line feeds in Preferences : Default Filing Options...

Perform the following steps to activate the PHP module in the OS X Apache Web server:

Choose OS X Tools from PageSpinner’s Windows menu.

Click the OS X Apache button in the OS X Tools palette and select the menu item Edit Configuration in Pico.

PageSpinner's the OS X Tools

The Terminal application will now be opened and you will be asked for a password. Enter the Admin password and the terminal-based Pico text editor will be started.

Press Ctrl+W to do a search in Pico.

Type php and press Return.

The Pico text edtor in the OS X Terminal

The following line should be displayed:
#LoadModule php4_module libexec/httpd/libphp4.so

Use the arrow keys to move the cursor and the backspace key to remove the # at the beginning of the line. The following line should then be displayed:
LoadModule php4_module libexec/httpd/libphp4.so

Press Ctrl+W and press Return again to find the line:
#AddModule mod_php4.c

Remove the # at the beginning:
AddModule mod_php4.c

Perform the following 3 steps if you are using Mac OS X 10.2:

  • Type Ctrl+V several times until you reach the end of the file.
  • Go to the end of the last line using the arrow keys and press Return.
  • Then paste the following line:
    AddType application/x-httpd-php .php

Press Ctrl+O and then press Return to confirm that you want to save.

Press Ctrl-X to quit Pico.

When Pico has quit, you need to restart the Apache server to make it use the new configuration. Type:
sudo apachectl graceful
in the OS X shell and press Return. Enter the Admin password and press Return.

You can now close the Terminal window.

Personal Web Sharing should now be running with PHP support enabled.


The final step is to give the Web server access rights to create, modify and delete files using PHP in your personal Sites folder.

Open your Home folder in Finder.

Select the Sites folder and choose Get Info from Finder’s File menu. (You can optionally select a subfolder inside the Sites folder instead of the entire Sites folder if you want to restrict PHP modification access to all contents inside the Sites folder).

Display the Ownership & Permissions section.
Click the Details sub-section if you are using Mac OS X 10.3 or 10.4

Click the Lock button to unlock the settings.

Choose Admin from the Group popup menu.

Enter your admin password if Finder asks for it.

Click the button Apply to enclosed items... and confirm that you want to apply the changes.

Congratulations, if everything has turned out successfully, PHP support should now be active and you are ready to explore the possibilities available with PHP!

Back

 

 
Book tips: PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide
Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems

 

SpinnerWorld - your Resource Center for information on PageSpinner and related Web spinning software, services, resources, tips and news. Search...

SpinnerWorld & the Optima Spinner Software is copyright © 2011 Optima System. All Rights Reserved.