View Full Version : How do I run php files?
snooziums
Jan 17, 2005, 07:20 PM
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?
jlewis2k1
Jan 17, 2005, 07:21 PM
i believe you need php installed ... i could be wrong but you can go to php.net for it.
brap
Jan 17, 2005, 07:25 PM
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.
snooziums
Jan 17, 2005, 09:47 PM
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?
slooksterPSV
Jan 17, 2005, 11:29 PM
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.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.