Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

snooziums

macrumors regular
Original poster
Hiya

I have Mac OS X 10.3.5. It came with the Apache web server built it. When I type in the following address: http : // localhost / (spaces added) it goes to the "sites" directory.

Okay, that is fine. It runs html files and cgi files fine. However, when I go to run a .php file, it only shows up as plain text.

How do I get it to actually run the php files within Safari, or any other web browser?
 
snooziums said:
How do I get it to actually run the php files within Safari, or any other web browser?
You need to edit your Apache httpd.conf file, all the mechanics of php are installed - you just need to enable them.

In the finder 'go' menu, choose /etc/httpd/, then get info on httpd.conf. Change the permissions to allow you to read & write, then edit away. You need to uncomment the two php4 modules... they're fairly obvious - I forget which they are top of my head, though.

Restart your Apache installation, and there you go.
 
Okay, I went into the httpd file and uncommented the php lines. And it now displays php files.

However, it will not accept any information sent to any php files. For example, if I type in the address bar: http : // localhost / myfile . php ? action = perform (spaces added), it will not do anything after the "?" at all. Is there something else I should be looking for?
 
snooziums said:
Okay, I went into the httpd file and uncommented the php lines. And it now displays php files.

However, it will not accept any information sent to any php files. For example, if I type in the address bar: http : // localhost / myfile . php ? action = perform (spaces added), it will not do anything after the "?" at all. Is there something else I should be looking for?

Yeah, you should type in 127.0.0.1/myfile.php?action=perform
You have to be routing to an IP address or a domain name (which routes to an ip address) where as the localhost just points to the folder with the files and shows them, it doesn't run the script because its like you are just looking at them, where as with an IP it runs the code. - Dunno how to explain it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.