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 > Enabling PHP locally on Apache

Enabling PHP locally on Apache
Thread Tools
Mac Enthusiast
Join Date: Nov 2002
Location: over yonder
Status: Offline
Reply With Quote
Jul 20, 2003, 11:05 PM
 
I'm trying to enable PHP on my computer locally so I can test my scripts without uploading them to my webhost.

I've followed the directions here, and the Apache error log reports that everything started up normally with PHP enabled.

However, when I tried to access the page I was working on, it just spit the source back at me rather than displaying it as a webpage.

I've tried permissions, I've set it as 755.

Any suggestions?
chown -R us:us yourbase

Dissent is not un-American.
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Jul 21, 2003, 03:46 AM
 
did you run sudo apachectl graceful afterwards?
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Mac Enthusiast
Join Date: Nov 2002
Location: over yonder
Status: Offline
Reply With Quote
Jul 23, 2003, 05:12 PM
 
Originally posted by philzilla:
did you run sudo apachectl graceful afterwards?
Thanks for the suggestion, but it's still doing the same thing.

It's just spitting the source back at me.

Anyone else have any suggestions?
chown -R us:us yourbase

Dissent is not un-American.
     
Senior User
Join Date: Dec 2002
Status: Offline
Reply With Quote
Jul 23, 2003, 06:24 PM
 
http://www.entropy.ch/software/macosx/php/

you'll have to download a (newer) PHP module, but the instructions are very good. never had a problem with em.
Travis Sanderson
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jul 23, 2003, 07:46 PM
 
it really sounds like you don't have the following lines uncommented:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
(make sure there isn't a # sign in front of them)

if those two are uncommented, try going to a page that doesn't exist (http://localhost/nonexistantpage.html) and see if it shows php in it's signiture. you should get something like:

Apache/1.3.27 mod_perl/1.99_07-dev Perl/v5.8.0 php version Server at localhost Port 80

if it isn't there then it (probably) isn't loaded.

--will
     
Mac Enthusiast
Join Date: Nov 2002
Location: over yonder
Status: Offline
Reply With Quote
Jul 23, 2003, 08:15 PM
 
Originally posted by clam2000:
it really sounds like you don't have the following lines uncommented:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
(make sure there isn't a # sign in front of them)

if those two are uncommented, try going to a page that doesn't exist (http://localhost/nonexistantpage.html) and see if it shows php in it's signiture. you should get something like:

Apache/1.3.27 mod_perl/1.99_07-dev Perl/v5.8.0 php version Server at localhost Port 80

if it isn't there then it (probably) isn't loaded.

--will
No. It was loaded as indicated by the terminal line when Apache was loaded.

I had to go download the distribution from 'entropy.ch' which fixed the problems and everything is working normally.

Thank you for all your help!
chown -R us:us yourbase

Dissent is not un-American.
     
Senior User
Join Date: Dec 2002
Status: Offline
Reply With Quote
Jul 23, 2003, 08:27 PM
 
I know you already fixed the problem via entropy, but:

It sounds like you're fairly computer-literate so I doubt this is the problem, but did you edit httpd.conf with root rights? I know if you use pico, it isn't all that obvious if you start editing it with normal rights. Just wonderin'.
Travis Sanderson
     
Mac Enthusiast
Join Date: Nov 2002
Location: over yonder
Status: Offline
Reply With Quote
Jul 24, 2003, 10:58 AM
 
Originally posted by redJag:
I know you already fixed the problem via entropy, but:

It sounds like you're fairly computer-literate so I doubt this is the problem, but did you edit httpd.conf with root rights? I know if you use pico, it isn't all that obvious if you start editing it with normal rights. Just wonderin'.
Yeah, I did edit httpd.conf with root rights. I actually just logged in as root and then opened the httpd.conf file with BBEdit.

Thanks for the suggestion.
chown -R us:us yourbase

Dissent is not un-American.
     
Mac Enthusiast
Join Date: Jan 2001
Location: East of Belfast Furry Animal Sanctuary
Status: Offline
Reply With Quote
Jul 24, 2003, 11:04 AM
 
you using safari for testing as it can be a pain with caching on the local server.

Also is the php file a 'text' file, try putting it onto your local server using an ftp tool like fetch and set it ascii/text for upload.

This was sometimes a problem for me and this fixed it
Torn apart by the wood peckers of mistrust t0 not have this happen 2 u visit guinea pig::the life of a mac designer::
     
Mac Enthusiast
Join Date: Nov 2002
Location: over yonder
Status: Offline
Reply With Quote
Jul 24, 2003, 11:25 PM
 
Originally posted by Griggsy:
you using safari for testing as it can be a pain with caching on the local server.

Also is the php file a 'text' file, try putting it onto your local server using an ftp tool like fetch and set it ascii/text for upload.

This was sometimes a problem for me and this fixed it
No, I wasn't using Safari. I was using Opera.

Yes, the file was text, saved that way in BBEdit.

Thanks for the suggestions everyone, using the distribution from 'entropy.ch' solved the problem and everything works great. Thank you!
chown -R us:us yourbase

Dissent is not un-American.
     
   
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 02:11 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