Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > php simply won't work - leopard

php simply won't work - leopard
Thread Tools
spitty27
Dedicated MacNNer
Join Date: Jan 2002
Location: Los Angeles
Status: Offline
Reply With Quote
Jun 13, 2008, 12:02 AM
 
ive replaced the httpd.conf located in /private/etc/apache2 with a fresh one from a fresh install of leopard, removed the # sign before the php5 module, but can't get any php file to load properly in safari.

all im seeing is the code. could somebody please help me out here as i'd like to be able to get php working

thanks
| MacBook Pro 2.4Ghz Core 2 Duo | 4GB Memory | 8x DL Superdrive | NVIDIA GeForce 8600M GT graphics with 256MB SDRAM | 160GB Internal running Leopard 10.5.6 | 500GB External | AirportExtreme + Bluetooth 2.0 | Logitech MxRevolution | Casio Exilim EX z75 | iPhone 3G Black |
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Jun 13, 2008, 12:24 AM
 
Did you add the appropriate PHP Mime types via the "AddType" Apache directive?

[codex]AddType application/x-httpd-php .php[/codex]

You'll probably also want to include index.php in your DirectoryIndex list as well:

[codex]DirectoryIndex index.html index.php index.htm[/codex]
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Jun 13, 2008, 12:25 AM
 
I'm assuming you also restarted Apache after modifying your httpd.conf via a:

sudo apachectl graceful
     
spitty27  (op)
Dedicated MacNNer
Join Date: Jan 2002
Location: Los Angeles
Status: Offline
Reply With Quote
Jun 13, 2008, 12:25 AM
 
sorry, excuse my ineptitudes, but could you tell me how and where to do this?
| MacBook Pro 2.4Ghz Core 2 Duo | 4GB Memory | 8x DL Superdrive | NVIDIA GeForce 8600M GT graphics with 256MB SDRAM | 160GB Internal running Leopard 10.5.6 | 500GB External | AirportExtreme + Bluetooth 2.0 | Logitech MxRevolution | Casio Exilim EX z75 | iPhone 3G Black |
     
spitty27  (op)
Dedicated MacNNer
Join Date: Jan 2002
Location: Los Angeles
Status: Offline
Reply With Quote
Jun 13, 2008, 12:26 AM
 
Last login: Thu Jun 12 20:56:08 on ttys000
Yoav-Weiss-MacBook-Pro:~ yweiss$ apachectl graceful
launchctl: CFURLWriteDataAndPropertiesToResource(/System/Library/LaunchDaemons/org.apache.httpd.plist) failed: -10
Yoav-Weiss-MacBook-Pro:~ yweiss$
| MacBook Pro 2.4Ghz Core 2 Duo | 4GB Memory | 8x DL Superdrive | NVIDIA GeForce 8600M GT graphics with 256MB SDRAM | 160GB Internal running Leopard 10.5.6 | 500GB External | AirportExtreme + Bluetooth 2.0 | Logitech MxRevolution | Casio Exilim EX z75 | iPhone 3G Black |
     
spitty27  (op)
Dedicated MacNNer
Join Date: Jan 2002
Location: Los Angeles
Status: Offline
Reply With Quote
Jun 13, 2008, 12:58 AM
 
ok. i seem to have found the right places...

i added index.htm and index.php to the directoryindex

and i added the addtype bit under the addtype section


the php page seems to load just fine now (when in webserver/documents) !!! thanks so much

but is there a way to get php to load properly no matter where it resides on the system? do i always have to throw it in that directory to view the page?

thanks for all your help
| MacBook Pro 2.4Ghz Core 2 Duo | 4GB Memory | 8x DL Superdrive | NVIDIA GeForce 8600M GT graphics with 256MB SDRAM | 160GB Internal running Leopard 10.5.6 | 500GB External | AirportExtreme + Bluetooth 2.0 | Logitech MxRevolution | Casio Exilim EX z75 | iPhone 3G Black |
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Jun 13, 2008, 01:53 AM
 
Originally Posted by spitty27 View Post
ok. i seem to have found the right places...

i added index.htm and index.php to the directoryindex

and i added the addtype bit under the addtype section


the php page seems to load just fine now (when in webserver/documents) !!! thanks so much

but is there a way to get php to load properly no matter where it resides on the system? do i always have to throw it in that directory to view the page?

thanks for all your help

I don't understand your question. PHP is not loaded when you access certain pages, PHP is a language that can be used to interpret and execute PHP webpages access via a web browser (you can also execute PHP scripts via the command line). Now that you have added the PHP module to the list of Apache modules that are loaded whenever the Apache service is loaded/restarted, PHP is loaded into memory and sitting idle until called upon.

Do you mean to ask how do you get PHP webpages to be served from other directories other than what the default is in OS X? If so, this is the "DocumentRoot" directive in httpd.conf. If you change this, you will change the directory where your website is served from.

Alternatively, if you want easy access to this directory from your home directory or something, you can either enable the UserDir Apache module so that you can serve up pages in the form of:

[codex]http://yourdomain/~yourusername[/codex]

Or add a symbolic link (which is virtually the same as an alias in OS X) from your Apache DocumentRoot to a directory in your home directory for easy access - a shortcut, if you will pardon my borrowing a Windows term
     
MacosNerd
Professional Poster
Join Date: Jun 2007
Status: Offline
Reply With Quote
Jun 13, 2008, 07:19 AM
 
I've found installer provided by Marc Liyange PHP is as simple as you can get for OSX. I've not really had to muck around the installing process when I went this route.

an even easier approach is to axmp this provides a self contained mysql, php, apache environment. You'll have to adjust the paths and ports since apache is already running. Personally I prefer using the delivered apache and installing php but if you're looking for a development platform xamp can provide a turnkey solution so you can beginning developing and not worry about configuration.

Even though configuration is half the fun
     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 12:45 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,