Web Server Configuration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Server Configuration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 18th, 2003, 08:28 PM
benos benos is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 233 benos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Article Dicussion: Using Apache and PHP on Mac OS X

If you have any questions or comments about this article please post them here.

This forum post relates to this article

Reply With Quote
  #2  
Old April 17th, 2003, 01:15 PM
sstump sstump is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 2 sstump User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP interpretation problems Mac OS X

Hello,

I am trying to enable php support on mac os x and i am running into problems. I wonder if anyone can help, because I can't figure it out! Here's what I did:

In Terminal:

cd /etc/httpd
sudo cp httpd.conf httpd.conf.orig

I entered my password, and opened the Apache config file in pico. There, I uncommented these lines:
LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c

And I added the line:
AddType application/x-httpd-php .php

(I followed instructions in Macworld 2002 article, "Serve It Up" by Scot Hacker. They seem to be very similar to the instructions in this article.)

I saved the file, and started Apache by turning on "Personal Web Sharing" in system prefs.

Then, I tested to see if my php module was correctly activated by creating a text file called test.php in my Sites folder which contains this single line of code:

<? phpinfo(); ?>

I browsed the file using URL

THE PROBLEM:

At this point, I am supposed to see a large colorful web page with all of PHP's statistics on my machine, but I only see the one line of raw php code that is in my test.php file: <? phpinfo(); ?> .

So, it seems as though the server is not interpreting the php, only displaying it. I have tried repairing permissions and several other troubleshooting shots int he dark, but to no avail. The kicker is that I was able to get it working on another machine that i have, using the same method.

Any suggestions would be helpful and very much appreciated!

Thanks.

Reply With Quote
  #3  
Old April 22nd, 2003, 07:46 PM
avit avit is offline
Not Yet Perfect
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Squamish, BC
Posts: 111 avit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to avit
Check if you in fact have the Apache extension for PHP installed at:

/usr/libexec/httpd/libphp4.so

If you don't have it, you can download one from http://www.entropy.ch. It has an easy installer. To quicky restart your webserver without going through the System Preferences, you can type:

sudo apachectl restart

Same goes for "stop" and "start"...

Reply With Quote
  #4  
Old April 23rd, 2003, 10:25 AM
sstump sstump is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 2 sstump User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the reply. I actually got the problem worked out...my original test.php file was created in Apple's TextEdit program ( with rich text features disabled). I created another using BBEdit, which I wouldn't think would matter, but now it works just fine. Go figure!

Reply With Quote
  #5  
Old May 15th, 2003, 07:15 PM
yannix yannix is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: paris
Posts: 3 yannix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hello avit,

i can t find those lines :

#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps

and then i can t delete the #...is it normal or do I have to insert those lines ??

Many thanx

Reply With Quote
  #6  
Old May 15th, 2003, 07:24 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
Quote:
Originally posted by yannix
hello avit,

i can t find those lines :

#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps

and then i can t delete the #...is it normal or do I have to insert those lines ??

Many thanx



you have to add those two lines under your cgi-bin directory
__________________
Apache Expert

Reply With Quote
  #7  
Old May 15th, 2003, 07:31 PM
yannix yannix is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: paris
Posts: 3 yannix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking

sorry, I m a rookie and I m afraid to don't understand : what is the cgi bin? a command that i can find inside of Pico?

thank you for your reply

Reply With Quote
  #8  
Old June 18th, 2003, 04:38 PM
A.Coles A.Coles is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 2 A.Coles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
novice advice

It doesn't seem as though anyone replied to Yannix's last post. I'm in the exact same position. Any advice?

A.C.

Reply With Quote
  #9  
Old June 19th, 2003, 04:24 AM
avit avit is offline
Not Yet Perfect
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Squamish, BC
Posts: 111 avit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to avit
On or around line 894 of your httpd.conf, you will see:
Code:
    #
    # To enable type maps, you might want to use
    #
    #AddHandler type-map var

Add those PHP lines after that, and before the IfModule ending tag:
Code:
    #
    # To enable type maps, you might want to use
    #
    #AddHandler type-map var

    # Enable PHP
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

</IfModule>

As long as LoadModule is also enabled (on or about line 238), you should be good to go.

Reply With Quote
  #10  
Old June 19th, 2003, 06:32 PM
A.Coles A.Coles is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 2 A.Coles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP enabled!

It's working!!!

Thank you so much. I've been reading through tutorials but I haven't been able to do any hands on stuff (my ISP doesn't support PHP).

This is great. Thanks again!

A.Coles

Reply With Quote
  #11  
Old February 2nd, 2006, 02:23 PM
jordan2delta jordan2delta is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Miami
Posts: 3 jordan2delta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 22 sec
Reputation Power: 0
Can't edit my httpd.config file

Newbie here!! Love all the techy stuff in this site!
I am trying to enable PHP on my Mac and I was reading how others have tried and succeeded but so far no cigar for me!
I am using a demo version of BBedit 8.2.4 and I can navigate to the hidden file "httpd.conf" but the file itself is grayed out, so I tried opening it up directly into BBedit with Terminal and this worked, but when I wanted to save the changes the "save" button is also grayed out.

I am the one and only user on my Mac and I checked to make sure and I do have admin level for my username. I also tried logging out and logging back in with a new username that has adminlevel, and same result...

Can anyone tell me what simple thing I'm doing wrong? I just want to save the original config file with a new name, then I want to save the PHP enabled, edited file as my new config file.

Appreciate the help asap!

Reply With Quote
  #12  
Old February 3rd, 2006, 11:04 AM
jordan2delta jordan2delta is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Miami
Posts: 3 jordan2delta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 22 sec
Reputation Power: 0
In case this helps another PHP-newbie like me, I found a partial solution for my "grayed out" hidden files. Instead of using the default open "all readable files" in BBedit, I used open "all files" and now I can open my hidden files!! Hey we weren't all born techies!

My new problem is how to save the hidden file back into the hidden folder. BBedit will only let me save the file to "visible" folders or anyhwere except hidden folders. So I saved the original httpd.conf file to my desktop.
Comments on this post
MadCowDzz agrees: Thanks for the followup!

Reply With Quote
  #13  
Old February 3rd, 2006, 12:03 PM
jordan2delta jordan2delta is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Miami
Posts: 3 jordan2delta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 22 sec
Reputation Power: 0
Hi avit!

I am having a similar problem to the one described by sstump, I cannot access my test php page in my browser. Is the url supposed to be my computer ip, followed by the tilde symbol, followed by my mac account username, then the test php file?
If so, that's what I typed into Safari and I got an "unable to connect to server error".

I rechecked my httpd.conf file and I have made all the edits found in www.sanbeiji.com/tech/tutorials/php/index.php/ site PLUS I followed your suggestion to sstump to add the AddType application line just after the "#AddHandler type-map var" line. I also double checked and I do have the Apache extension for PHP installed in my Mac.

Can you help me with this connection problem? I'd like to see this php document so I can really suffer with learning this php stuff!

BTW I'm impressed withyour 111 posts!! Now I have post envy LOL...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Server Configuration > Article Dicussion: Using Apache and PHP on Mac OS X


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |