How do I run php files?

Discussion in 'Mac Apps and Mac App Store' started by snooziums, Jan 17, 2005.

  1. snooziums macrumors regular

    Joined:
    Apr 30, 2004
    Location:
    Evergreen State
    #1
    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?
     
  2. jlewis2k1 macrumors 6502a

    jlewis2k1

    Joined:
    Jan 14, 2005
    Location:
    in your closet
    #2
    i believe you need php installed ... i could be wrong but you can go to php.net for it.
     
  3. brap macrumors 68000

    Joined:
    May 10, 2004
    Location:
    Nottingham
    #3
    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.
     
  4. snooziums thread starter macrumors regular

    Joined:
    Apr 30, 2004
    Location:
    Evergreen State
    #4
    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?
     
  5. slooksterPSV macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #5
    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.
     

Share This Page