How do I view a PHP file?

Discussion in 'PHP' started by Illumine1983, Nov 25, 2007.

  1. #1
    As a test I pasted a PHP script into Notepad between HTML tags and saved it as test.php on my hard drive.

    When I try to browse to it the file doesn't open - do I have to upload it to a server to test it, or have I made some silly basic mistake somewhere?

    Thanks!
     
    Illumine1983, Nov 25, 2007 IP
  2. serialCoder

    serialCoder Guest

    Best Answers:
    0
    #2
    you need at least a webserver (apache) put it in htdocs and run it from there
     
    serialCoder, Nov 25, 2007 IP
  3. life31

    life31 Active Member

    Messages:
    1,024
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Yes you need a server intalled on your system. Something like PHP DEV or WAMP or UNISERVER wich allows you to vie php files after connecting to localhost.
     
    life31, Nov 25, 2007 IP
  4. Illumine1983

    Illumine1983 Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I've got XAMPP - will that work?
     
    Illumine1983, Nov 25, 2007 IP
  5. serialCoder

    serialCoder Guest

    Best Answers:
    0
    #5
    yep! thats the one i'm using now, just put the file anywhere inside the htdocs folder and access it through your browser with this url

    http://localhost/pathtofile/filename.php
     
    serialCoder, Nov 25, 2007 IP
  6. Illumine1983

    Illumine1983 Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks, how would I access my D drive using a url like that?
     
    Illumine1983, Nov 25, 2007 IP
  7. d-crafts

    d-crafts Banned

    Messages:
    427
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Xampp is good. You can also try installing EasyPHP.

    Install Xampp in your D drive. after successfully installation, put your test.php file into htdocs direcotry. then run a browser addressing http://localhost/test.php :D
     
    d-crafts, Nov 25, 2007 IP
  8. Illumine1983

    Illumine1983 Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Awesome, it works - now I can get down to learning PHP :)
    If the installation process is anything to go by, it looks like it will be a very long and complicated journey!
    I still wonder why it comes up as a Broderbund Print Quick Type icon in Explorer, but as long as I can now access my scripts the journey can start.

    Thanks again for everyone's help; have a great weekend :D
     
    Illumine1983, Nov 25, 2007 IP