PHP and MySQL

Discussion in 'Web Design and Development' started by bmcgonag, Jul 2, 2007.

  1. bmcgonag macrumors 65816

    bmcgonag

    Joined:
    Mar 20, 2007
    Location:
    Texas
    #1
    I installed PHP (latest version) and MySQL (same) as some tutorials instructed from online, and I don't know where to put the index.php file now on my iMac to view it in a web page on my local machine.

    I tried it in the /Library/WebServer/Documents, no luck, just displays the code...

    tried it in my home Sites folder, same thing. Any help is appreciated.

    Do I need to start PHP?

    Brian
     
  2. macfaninpdx macrumors regular

    Joined:
    Mar 6, 2007
    #2
    First, turn on the Personal Web (Start) preference in System Preferences -> Sharing. Once you start the Personal Web, it will tell you your local IP address.


    Then put the file in ~/Sites/<some_folder>/. You should then be able to view it at either:
    http://localhost/~<Your_Username>/<some_folder>/index.php
    or
    http://1.2.3.4/~<Your_Username>/<some_folder>/index.php

    You can use the /Library/WebServer/Documents/ folder if you do not want it to be in your home directory.
     
  3. bmcgonag thread starter macrumors 65816

    bmcgonag

    Joined:
    Mar 20, 2007
    Location:
    Texas
    #3
    I did exactly that....but when i type in the url (basically http://127.0.0.1/index.php or http://127.0.0.1/~myhome/index.php) it just shows me the php code on the page, it does not render the page in the browser.

    I don't know what i'm doing wrong, but i need to do something to get it to render the page in the browser window.

    Brian
     
  4. Poeben macrumors 6502

    Joined:
    Jul 29, 2004
    #4
    Sounds like php is disabled. You can enable it by editing the httpd.conf file located in /etc/httpd/ and removing the # in front of php.

    This should point you in the right direction:


    Enabling PHP


    As for running the latest version, you're on your own there, but this will give you an idea..
     
  5. bmcgonag thread starter macrumors 65816

    bmcgonag

    Joined:
    Mar 20, 2007
    Location:
    Texas
    #5
    Perfect, it's working great! thanks

    Brian
     
  6. Fearless Leader macrumors 68020

    Joined:
    Mar 21, 2006
    Location:
    Hoosiertown
    #6
    oh wow thanks. I had also had this issue a while ago, but gave up.
     

Share This Page