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 > Mac OS X > php not working...

php not working...
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2003
Status: Offline
Reply With Quote
May 4, 2004, 03:57 AM
 
I downloaded the .tar file from php.net and ./configured and made it. But when I create a .php file my browser (safari) doesn't show anything. Is there anything else I need to do to get php to work?

Thanks

P.S. I just wanted to show something like <?php phpinfo() ?> or <? print("Hello World") ?>
     
Forum Regular
Join Date: Apr 2003
Location: Toronto, Canada
Status: Offline
Reply With Quote
May 4, 2004, 05:54 AM
 
You can download a Mac OS X PHP installer from Entropy.

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

Really easy to set up and use!
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
May 4, 2004, 07:31 AM
 
Entropy is great and has it all. If you just want to enbale php in your Apache install, you need to edit the /etc/httpd/httpd file. Be sure to make a backup of it before making modifications. Be sure to make a backup of it before making modifications.

You will need to use your admin password to be able to write to the file.

If you are familiar with the text editors that come with Terminal you can use vim, emacs or pico to edit the file. If not, BBEdit lets you open hidden files from its edit menu. You can use TextEdit, but will need to use the Finder's Goto Folder command (shift-command-G) and enter /etc/httpd in the message window to open the container folder. For TextEdit first use the Finder's duplicate command to make a copy of the file the right click on the original, the Open with..., then Other.. and select TextEdit.

In the editor use Find to locate lines with php in them. There are two lines that need to be changed. One is the LoadModule php4 line and the other is the AddModule php4 line. Both have been commented out by having the line start with a #. Remove the # from both.

Save the file. Use either the Terminal command apachectl restart or the System Preferences Sharing Pref Pane to turn off then turn on your webserver.

Recap- make a backup of the httpd.conf file, edit the original to un-comment the LoadModule php... and AddModule php... lines, restart the server.

HTH
Craig
(Last edited by suthercd; May 5, 2004 at 05:59 PM. )
     
Fresh-Faced Recruit
Join Date: Nov 2003
Status: Offline
Reply With Quote
May 4, 2004, 01:02 PM
 
thanks for the replies.
One more question though. Will php only work if i have the web sharing enabled and only in the ../Sites directory? Like I have another .php file in a different place but I cannot see the contents?
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
May 5, 2004, 01:38 AM
 
Originally posted by hurric00:
thanks for the replies.
One more question though. Will php only work if i have the web sharing enabled and only in the ../Sites directory? Like I have another .php file in a different place but I cannot see the contents?
Yes, PHP will only work if you have web sharing enabled. Apache is what "Personal Web Sharing" uses.

When you enable Apache there are two places you can put files. The "Personal" aspect of web sharing is that Mac OS X makes web folders for each user in their home directories that can be accessed by: http://www.server.com/~hurric00/phpinfo.php. Otherwise, you can put stuff in the root of the server...

The default document "root" for files to be shared via your web server is /Library/WebServer/Documents/, you can put files in there and have them be accessed from the webserver as such: http://www.server.com/phpinfo.php.

Did that help?
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
May 5, 2004, 09:43 AM
 
You can also edit httpd.conf to recognize different paths for documents, However, you then are making modifications to your system security. Read the comments at the beginning of the httpd.conf file to get a quick overview of how Apache can be configured. Also, http://127.0.0.1/manual/ in your browser once you have your web server on will give you the details of Apache.

Often a poorly or naively written cgi or php file is the entry door for people you probably don't want to be able to access your machine. Beware and be informed as you explore. FWIW

Craig
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
May 5, 2004, 10:22 AM
 
Also, yeah, PHP is installed on Panther. So if you're running Panther, all you have to do is edit your /etc/httpd/httpd.conf for those two module lines that suthercd was talking about and then restart Apache.

"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Fresh-Faced Recruit
Join Date: Nov 2003
Status: Offline
Reply With Quote
May 5, 2004, 12:23 PM
 
O I see... Thanks all. I set up php and mysql myself from source. they seem to be working now.
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
May 5, 2004, 05:41 PM
 
Originally posted by hurric00:
O I see... Thanks all. I set up php and mysql myself from source. they seem to be working now.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
   
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 09:37 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