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 not interpreting page...

php not interpreting page...
Thread Tools
Registered User
Join Date: Sep 2002
Location: New York City
Status: Offline
Reply With Quote
May 9, 2003, 09:52 PM
 
Administrator, I figured out the solution. You may Delete the post if you like, or you may leave it for others to use. Isn't it always the case that just when you ask others for you...you stumble across the answer.

-------

I found this script on the Web..you can run it in the Terminal window to get the OSX built-in PHP to work.

% cd /etc/httpd
% sudo apxs -e -a -n php4 libexec/httpd/libphp4.so
% echo 'echo "AddType application/x-httpd-php .php" etc/httpd/httpd.conf' | sudo sh -s
% sudo apachectl graceful
(and then it goes on to explain how to make index.php automatically load when there is not other page)

so, this script worked in the past. Yesterday I re-installed OSX and the software update brought me to 10.2.6
now the script is not working completely

when I try viewing a page at "127.0.0.1/test.php" the page is displayed as html, and the php appears too! the php-interpreter should run the necessary code and send just html to the browser, but it is not doing it.

Does anyone know what I should modify/review inorder to fix it so that the php is interpreted properly?

ANSWER:
needed to have this line of the httpd.conf activated...
AddType application/x-httpd-php .php
(Last edited by bens1901; May 9, 2003 at 10:45 PM. )
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
May 13, 2003, 02:51 PM
 
Yes, well that'll work, but there is a better way. Under MacOS X, you're better off not modifying Apache's main httpd.conf (as you're doing in the "script" you cite), but rather adding AddType application/x-httpd-php .php line in a separate file stored in /private/etc/httpd/users/

Notice the last line of Apple's standard httpd.conf file:

  Include /private/etc/httpd/users

That appends every file in the directory /private/etc/httpd/users/, in alphabetical order, to your /etc/httpd/httpd.conf file. So if you place a file containing only the customizations you would otherwise make to /etc/httpd/httpd.conf in the directory /private/etc/httpd/users/, your customizations will always be in effect without ever modifying your /etc/httpd/httpd.conf file, and they won't break with various system updates.
     
Registered User
Join Date: Sep 2002
Location: New York City
Status: Offline
Reply With Quote
May 13, 2003, 02:56 PM
 
great suggestion. Thanks.

-Ben
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:31 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2