image
image

Go Back   macosx.com > Mac Help Forums > Mac OS X System & Mac Software

Reply
 
Thread Tools
  #1  
Old October 28th, 2002, 12:54 PM
Support Specialist
 
Join Date: Jul 2002
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
sixthring is on a distinguished road
Enabling PHP in 10.2 Client

I would put this in the How To Forum but I can not add new threads. I also realize there is a PHP how to thread but it is for 10.0-10.1.x not 10.2 specifically, and it is getting a little long in the tooth. On to the instructions.

Although Apple builds Apache and support for PHP into OS X.2, it doesn’t actually turn these features on. You’ll have to do that part yourself. Here’s how:

Turn PHP Support On

To activate Apache’s PHP module, you’ll first need to modify the Apache configuration file. Since the configuration file is hidden from the Finder, you’ll have to make a trip to the command line.
Open Terminal (Applications: Utilities: Terminal). Before you make any changes, you’ll want to create a backup of your Apache configuration file—just in case something goes wrong. To do this, type the following commands into the Terminal window:

cd /etc/httpd

sudo cp httpd.conf httpd.conf.orig

Enter your administrator password when prompted, and then type sudo pico httpd.conf. This command opens your Apache configuration file in pico, a Unix text editor. In pico, press control-W to open the Find command, and then type php. When you hit the return key, your cursor should land on the line:

#LoadModule php4_module libexec/httpd/libphp4.so

Using the left-arrow key to move your cursor, remove the # character at the beginning of this line. Press control-W again. This time, type the string:

mod_php4.c and press return.

Remove the # character from the beginning of this line as well. Press control-W a third time and search for the string x-tar. When you land on it, move your cursor to the end of the line, press return, and then add the line:

AddType application/x-httpd-php .php

Once you’ve made these three changes, save the file by pressing control-O and then the return key. Press control-X to exit pico. Apache should now automatically load the PHP module on start-up. When the Web server encounters pages ending in .php, it’ll send them to the PHP module for interpretation.

Start Apache

With PHP enabled, you’re ready to flip the switch on your Web server. Open your System Preferences and select Sharing. Click on the Services tab, and select the Personal Sharing option. Click on Start. (If Web sharing was already on, you’ll need to turn it off and then back on to activate the changes you’ve made.)

Testing

To find out whether the PHP module has been correctly activated, open your favorite text editor and create a new document. (If you’re using Apple’s TextEdit, make sure you’ve turned off the pro gram’s Rich Text features, in Preferences, first.) In your blank document, type <? Phpinfo(); ?>. Save the file as test.php in the Sites folder in your user’s folder. Open your Web browser, and type in the address http I host/ ph p, where username is your short name on the OS X machine. (Because PHP is a server-parsed language, nothing will happen if you open a PHP file in your Web browser via the File menu or by double-clicking. To execute PHP pages, you must access them through a PHP-enabled Web server.)
Your browser should display tables packed with arcane data about your new PHP environment. If you see only one line of raw PHP code, repeat this step.
Reply With Quote
  #2  
Old October 28th, 2002, 01:02 PM
3mors's Avatar
HampCake Studios
 
Join Date: Oct 2001
Posts: 660
Thanks: 0
Thanked 0 Times in 0 Posts
3mors is on a distinguished road
Or read this guide:

http://www.entropy.ch/software/macosx/php/

__________________
3mors
------------------------------------------------------
iMac G5 20"/MacBook Pro 17"/PowerBook G4
------------------------------------------------------
Reply With Quote
  #3  
Old October 28th, 2002, 01:48 PM
twister's Avatar
Howdy
 
Join Date: Oct 2000
Location: Minneapolis MN
Posts: 2,517
Thanks: 0
Thanked 1 Time in 1 Post
twister is on a distinguished road
any smart people know how to erase or re-create a php.ini file? Mine is jacked and i want to get rid of it and create a new one.

Any help would be awesome.

Twister
__________________
:: TwisterMc ::
:: Wrestling Gear : iPox Firefox Skin ::
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[HOWTO] - Setup PHP & MySQL yoshi HOWTO & FAQs 225 January 2nd, 2005 01:39 AM
php / curl & default 10.2 installation hyph-n Unix & X11 0 September 21st, 2003 06:12 AM
Enabling Local sendmail (10.2 - m4 prob?) Ghent Unix & X11 3 February 15th, 2003 11:23 PM
10.2 php Enable Powermaster Mac OS X System & Mac Software 4 September 15th, 2002 03:58 PM
Upgrading OS X Server 10.1.4 to 10.2 Essage Mac OS X System & Mac Software 0 September 5th, 2002 12:01 PM


All times are GMT -5. The time now is 08:32 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.