Safari doesn't open PHP files

Discussion in 'Mac Apps and Mac App Store' started by sawmaster, Nov 12, 2008.

  1. sawmaster macrumors regular

    #1
    If i try to open a PHP file in safari, it shows the code. If the PHP file isn't local, for example, on a local website (using air sharing on my ipod touch and adding php files to it), it will download the file. If I open it there, it will only display the codes like it does on the original file on my mac. I'm trying to use wordpress but it doesn't work. Once I think i saw some of the page working (it was the login page and it was PHP). But i've tried everything i could do but it never worked again. Please help me! Thanks!
     
  2. themoonisdown09 macrumors 601

    themoonisdown09

    Joined:
    Nov 19, 2007
    Location:
    Georgia, USA
    #2
    Do you have the Apache service running? If you don't, I can't help you now because I'm not on my Mac.
     
  3. sawmaster thread starter macrumors regular

    #3
    There's my other issue. It won't turn on. If i turn on personal web sharing, it just freezes at Web Sharing Starting up...

    If you can, please help! (since your not on your mac, you may not be able to lol)
     
  4. themoonisdown09 macrumors 601

    themoonisdown09

    Joined:
    Nov 19, 2007
    Location:
    Georgia, USA
    #4
    What version of OS X do you have?
     
  5. JNB macrumors 604

    JNB

    Joined:
    Oct 7, 2004
    Location:
    In a Hell predominately of my own making
    #6
    php files cannot be viewed as the intended page by merely "opening" them. WP has to be installed on a host on top of a (typically) mySQL db. You have to point the installation to the correct database for proper service. Read the WP installations carefully and follow them explicitly. It works just fine if you follow the directions.

    Here's the install instructions. You have to run the install.php after FTP'ing to your host.
     
  6. sawmaster thread starter macrumors regular

    #7
    Mac OS X v10.4.11
     
  7. themoonisdown09 macrumors 601

    themoonisdown09

    Joined:
    Nov 19, 2007
    Location:
    Georgia, USA
    #8
    I guess I didn't read the OP's post all the way because I missed that he was using WordPress.
     
  8. sawmaster thread starter macrumors regular

    #9
    I GOT IT! I have the installation PHP file working. It's hosted on my ipod touch using air sharing. The page though, looks awful! lol And when i try entering my details, (i'm guessing the box above is the username and the box below is the password lol) then i press this strange button with a code in it. It looks like it's suppost to say Install Word Press. If I click that, it just does nothing. :(
     
  9. JNB macrumors 604

    JNB

    Joined:
    Oct 7, 2004
    Location:
    In a Hell predominately of my own making
    #10
    Wait a minute. You're hosting it from the iPod?
     
  10. memco macrumors 6502

    Joined:
    May 1, 2008
    #11
    If you're running this on your ipod you're going need to find a server of some kind with PHP and MySQL support. I can't remember if it exists, but I know I've read at least one person has used the iPhone/iPod as a web-server. PHP pages can't simply be opened, they have to be interpreted by a server first, which requires some local installation and customization.
     
  11. sawmaster thread starter macrumors regular

    #12
    Well, I fixed my server. If I go to my url, http://71.193.112.221/~sawmaster/wordpress/ , it still doesn't work.

    I don't always host this from my iPod. I was just doing it that way temporary.

    Does anybody have any luck with the url above?

    And I got the Apache server. Not any other kind of server.
     
  12. Darth.Titan macrumors 68030

    Darth.Titan

    Joined:
    Oct 31, 2007
    Location:
    Austin, TX
    #13
    You have some work to do with your Apache config. It's not interpreting the PHP code, it's just dishing it out as text.

    There are 100 how-tos around for configuring Apache on most versions of OS X. Google is your friend.

    BTW, posting a link to your personal machine via IP on a public message board is probably not the best idea...
     
  13. sawmaster thread starter macrumors regular

    #14
    I thought it wasn't a good idea..

    For some reason, it seems that I keep doing wrong things lol. I bumped this thread. I got a warning.
     
  14. nelmat macrumors 6502a

    Joined:
    Jul 10, 2008
    #15
    PHP/MySQL on mac

    Go grab a copy of mamp and get yourself up and running. You simply haven't enabled PHP properly. The MAMP installation is the simplest PKG way of doing this for newbies. Hope that helps.
     
  15. sawmaster thread starter macrumors regular

    #16
    What I just did to an apache file:

    I edited the config file in the apache server.
    Location: ect/httpd/httpd.conf

    I didn't feel like looking through the entire page to find what to un-comment. So I searched for php by clicking (on the menu bar), Edit>>Find>>Find...
    And I searched for PHP. This is the first result:
    Code:
    # Dynamic Shared Object (DSO) Support
    #
    # To be able to use the functionality of a module which was built as a DSO you
    # have to place corresponding `LoadModule' lines at this location so the
    # directives contained in it are actually available _before_ they are used.
    # Please read the file http://httpd.apache.org/docs/dso.html for more
    # details about the DSO mechanism and run `httpd -l' for the list of already
    # built-in (statically linked and thus always available) modules in your httpd
    # binary.
    #
    # Note: The order in which modules are loaded is important.  Don't change
    # the order below without expert advice.
    #
    # Example:
    # LoadModule foo_module libexec/mod_foo.so
    #LoadModule vhost_alias_module libexec/httpd/mod_vhost_alias.so
    #LoadModule env_module         libexec/httpd/mod_env.so
    LoadModule config_log_module  libexec/httpd/mod_log_config.so
    #LoadModule mime_magic_module  libexec/httpd/mod_mime_magic.so
    LoadModule mime_module        libexec/httpd/mod_mime.so
    LoadModule negotiation_module libexec/httpd/mod_negotiation.so
    #LoadModule status_module      libexec/httpd/mod_status.so
    #LoadModule info_module        libexec/httpd/mod_info.so
    LoadModule includes_module    libexec/httpd/mod_include.so
    LoadModule autoindex_module   libexec/httpd/mod_autoindex.so
    LoadModule dir_module         libexec/httpd/mod_dir.so
    LoadModule cgi_module         libexec/httpd/mod_cgi.so
    LoadModule asis_module        libexec/httpd/mod_asis.so
    LoadModule imap_module        libexec/httpd/mod_imap.so
    LoadModule action_module      libexec/httpd/mod_actions.so
    #LoadModule speling_module     libexec/httpd/mod_speling.so
    LoadModule userdir_module     libexec/httpd/mod_userdir.so
    LoadModule alias_module       libexec/httpd/mod_alias.so
    LoadModule rewrite_module     libexec/httpd/mod_rewrite.so
    LoadModule access_module      libexec/httpd/mod_access.so
    LoadModule auth_module        libexec/httpd/mod_auth.so
    #LoadModule anon_auth_module   libexec/httpd/mod_auth_anon.so
    #LoadModule dbm_auth_module    libexec/httpd/mod_auth_dbm.so
    #LoadModule digest_module      libexec/httpd/mod_digest.so
    #LoadModule proxy_module       libexec/httpd/libproxy.so
    #LoadModule cern_meta_module   libexec/httpd/mod_cern_meta.so
    #LoadModule expires_module     libexec/httpd/mod_expires.so
    #LoadModule headers_module     libexec/httpd/mod_headers.so
    #LoadModule usertrack_module   libexec/httpd/mod_usertrack.so
    LoadModule log_forensic_module libexec/httpd/mod_log_forensic.so
    #LoadModule unique_id_module   libexec/httpd/mod_unique_id.so
    LoadModule setenvif_module    libexec/httpd/mod_setenvif.so
    #LoadModule dav_module         libexec/httpd/libdav.so
    #LoadModule ssl_module         libexec/httpd/libssl.so
    #LoadModule perl_module        libexec/httpd/libperl.so
    #LoadModule php4_module        libexec/httpd/libphp4.so
    LoadModule hfs_apple_module   libexec/httpd/mod_hfs_apple.so
    LoadModule bonjour_module     libexec/httpd/mod_bonjour.so
    And un-commented after the example.
    Today, it now looks like this:
    Code:
    # Dynamic Shared Object (DSO) Support
    #
    # To be able to use the functionality of a module which was built as a DSO you
    # have to place corresponding `LoadModule' lines at this location so the
    # directives contained in it are actually available _before_ they are used.
    # Please read the file http://httpd.apache.org/docs/dso.html for more
    # details about the DSO mechanism and run `httpd -l' for the list of already
    # built-in (statically linked and thus always available) modules in your httpd
    # binary.
    #
    # Note: The order in which modules are loaded is important.  Don't change
    # the order below without expert advice.
    #
    # Example:
    # LoadModule foo_module libexec/mod_foo.so
    LoadModule vhost_alias_module libexec/httpd/mod_vhost_alias.so
    LoadModule env_module         libexec/httpd/mod_env.so
    LoadModule config_log_module  libexec/httpd/mod_log_config.so
    LoadModule mime_magic_module  libexec/httpd/mod_mime_magic.so
    LoadModule mime_module        libexec/httpd/mod_mime.so
    LoadModule negotiation_module libexec/httpd/mod_negotiation.so
    LoadModule status_module      libexec/httpd/mod_status.so
    LoadModule info_module        libexec/httpd/mod_info.so
    LoadModule includes_module    libexec/httpd/mod_include.so
    LoadModule autoindex_module   libexec/httpd/mod_autoindex.so
    LoadModule dir_module         libexec/httpd/mod_dir.so
    LoadModule cgi_module         libexec/httpd/mod_cgi.so
    LoadModule asis_module        libexec/httpd/mod_asis.so
    LoadModule imap_module        libexec/httpd/mod_imap.so
    LoadModule action_module      libexec/httpd/mod_actions.so
    LoadModule speling_module     libexec/httpd/mod_speling.so
    LoadModule userdir_module     libexec/httpd/mod_userdir.so
    LoadModule alias_module       libexec/httpd/mod_alias.so
    LoadModule rewrite_module     libexec/httpd/mod_rewrite.so
    LoadModule access_module      libexec/httpd/mod_access.so
    LoadModule auth_module        libexec/httpd/mod_auth.so
    LoadModule anon_auth_module   libexec/httpd/mod_auth_anon.so
    LoadModule dbm_auth_module    libexec/httpd/mod_auth_dbm.so
    LoadModule digest_module      libexec/httpd/mod_digest.so
    LoadModule proxy_module       libexec/httpd/libproxy.so
    LoadModule cern_meta_module   libexec/httpd/mod_cern_meta.so
    LoadModule expires_module     libexec/httpd/mod_expires.so
    LoadModule headers_module     libexec/httpd/mod_headers.so
    LoadModule usertrack_module   libexec/httpd/mod_usertrack.so
    LoadModule log_forensic_module libexec/httpd/mod_log_forensic.so
    LoadModule unique_id_module   libexec/httpd/mod_unique_id.so
    LoadModule setenvif_module    libexec/httpd/mod_setenvif.so
    LoadModule dav_module         libexec/httpd/libdav.so
    LoadModule ssl_module         libexec/httpd/libssl.so
    LoadModule perl_module        libexec/httpd/libperl.so
    LoadModule php4_module        libexec/httpd/libphp4.so
    LoadModule hfs_apple_module   libexec/httpd/mod_hfs_apple.so
    LoadModule bonjour_module     libexec/httpd/mod_bonjour.so
    I had no idea what people mean when they want other people to restart apache. So I un-checked "Personal Web Sharing" in the Sharing panel. Then I rechecked it. Everything works fine. Except PHP.

    REMEMBER: I'm trying to use wordpress.

    Also, when I type in "/wordpress/" on my site, instead of seeing the default apache file browser, I see a fancy wordpress file browser. Amazing! This story gets more suspishish and exiting and intense!
     
  16. sawmaster thread starter macrumors regular

    #17
    Exuse me a moment, i'm going to go to a party celebrating THIS SWEEEEETTTTT APPLICATION!!!! THANKS LIKE DEAD CRAZY! THHAATAAANKS!!!


    Pardon my exitedness. :D:D:D:D:D
     
  17. sawmaster thread starter macrumors regular

    #18
    Wow, you made my page creator possible!

    PM me for a link.
     
  18. moosa macrumors newbie

    Joined:
    Nov 19, 2009
    Location:
    Melbourne, Vic
    #19
    Re:

    Well... I am having the same problem and I didnt have any trouble installing MAMP and my servers are running absolutely fine. Can anyone tell me why I am getting this error message and Safari wont open the install.php file?
     
  19. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #20
    What error message?
    How are you trying to open the install.php file?
     
  20. JakeGWood macrumors newbie

    Joined:
    Jul 3, 2011
    #21
    I had a similar problem, but I am not using wordpress. However, after using the foundationphp.com link, my browsers correctly read .php, but only in the MacintoshHD>Library>Webserver>Documents folder. But when I put the .php files anywhere else, in my case the desktop, my browsers view the file as textedit would view it, and then download the file. So how could I get .php files read correctly from any address?
     
  21. Brandon Sky macrumors newbie

    Joined:
    Feb 27, 2012
    #22
    Safari doesn't support PHP

    Safari versions prior to 5.0 do not support PHP. I have tested PHP on Opera, Firefox, Google Chrome, and Camino. It seems it only works with these four browsers. I tested PHP with Safari 5.1 and it works.
     
  22. nelmat macrumors 6502a

    Joined:
    Jul 10, 2008
    #23
    That is wrong. safari fully supports php and always has. check your code!
     

Share This Page