|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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"... |
|
#4
|
|||
|
|||
|
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!
|
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
Quote:
you have to add those two lines under your cgi-bin directory ![]()
__________________
Apache Expert |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
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. |
|
#9
|
|||
|
|||
|
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. |
|
#10
|
|||
|
|||
|
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 |
|
#11
|
|||
|
|||
|
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! ![]() |
|
#12
|
|||
|
|||
|
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. |
|
#13
|
|||
|
|||
|
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... |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Server Configuration > Article Dicussion: Using Apache and PHP on Mac OS X |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|