How to check that PHP is Installed ?

Discussion in 'PHP' started by prismmb, Apr 16, 2007.

  1. #1
    Hello Guys


    I never Installed PHP on my PC Before, I used webserver before.

    Now I Installed XAMPP (that Install Apache,PHP,MySql) on my PC

    So how do I checked that PHP is installed or not ???


    and Where should I place my file to run like in IIS server there is one folder in which you have to put all your files, is there any folder in php where you have to put your file to run ??

    Plz. Help me in this silly questions ;)

    (I used to do programming in Visual Basic but now I want to learn php so plz. help me in this)

    your suggession is also welcome to Learn PHP Easily

    Thanks in Advance
     
    prismmb, Apr 16, 2007 IP
  2. stevecrozz

    stevecrozz Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    find your htdocs folder and drop any php file in it, then access it from http://localhost/whatever.php

    Try this one:
    <?php
    echo phpinfo();
    ?>
    Code (markup):
    also I think if you just go to http://localhost XAMPP will have a php test page already. Just click on that.
     
    stevecrozz, Apr 16, 2007 IP
  3. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #3
    1.
    create a regular HMTL file
    i.e. head / body

    into your empty body place the following code

    <? phpinfo(); ?>

    save the file - with .php file extension in the folder your apache is configured as your server-root ( if unsure, look into the apache config file to see where on your system apache server / starts

    then open the file with above code in your browser using http:// ... path to your file on your localhost

    you then will see a long page filled with all useful data of what you have on localhost

    if that works - then PHP works on your system
    else
    back to step 1 webmaster studies
     
    hans, Apr 16, 2007 IP
  4. anna.sobiepanek

    anna.sobiepanek Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    C:\Inetpub\wwwroot is where ur files should be placed.
    On the web browser it is http://localhost/

    if u create a file called info.php
    which contains JUST No blanks before:
    <?phpinfo();?>


    and save it in C:\Inetpub\wwwroot
    then u should go to http://localhost/info.php

    A php information page should be displayed with all of ur initial variables. Google phpinfo for an example
     
    anna.sobiepanek, Apr 16, 2007 IP
  5. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Why do you say no blanks before? It doesn't matter if there is any text before the phpinfo or not.
     
    Aragorn, Apr 16, 2007 IP
  6. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #6
    NO empty space = NO "nbsp" before the code
    <? phpinfo(); ?>
    just DO it - then you see
     
    hans, Apr 17, 2007 IP
  7. prismmb

    prismmb Guest

    Messages:
    82
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    43
    #7
    Currently I don't have IIS installed so where is Inetput/wwwroot folder Currently I only have Apache installed.

    So where is this type of folder in Apache ??

    Waiting for your reply.

    Thanks
     
    prismmb, Apr 17, 2007 IP
  8. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #8
    1.
    may be its time to study VERY basic apache stuff first
    http://httpd.apache.org/docs/1.3/misc/howto.html

    2.
    apache config file name usually is ( depending on precise apache version )

    either
    default-server.conf
    or
    httpd.conf

    search in your own PC for such filenames
    find the folder where you installed apache
    look at your config
    you may have to configure much more later on

    3.
    Google search for
    apache howto windows
     
    hans, Apr 17, 2007 IP
  9. prismmb

    prismmb Guest

    Messages:
    82
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    43
    #9
    Hi

    I found httpd.conf on my PC

    This are the lines that I found in this file

    #
    # ServerRoot: The top of the directory tree under which the server's
    # configuration, error, and log files are kept.
    #
    ServerRoot "D:/Program Files/Apache Group/Apache"
    
    HTML:
    So i copy my test.php files in this directory but when i go to
    http://localhost/test.php then gives me error that "Page Can not be Found"

    Can you plz. guide me , did i select wrong folder to place my php files ??

    Waiting for your reply.

    Thanks
     
    prismmb, Apr 17, 2007 IP
  10. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #10
    I am a Linux professional and NO XP at all -
    you really should learn the basics of the basics by studying apache howto !!

    localhost is the Linux version and may NOT work on your XP

    hence another way to test is to use your local IP
    assuming you have local IP of 192.168.0.1
    then a in your browser
    http: // with your local IP
    should show you some default start page

    if so - then test in the same path your php-test-page

    if you have such enormous problems with most basic user stuff - i recommend you to eaither first learn basics ot change job
    what you have now is far less than 1% of the work, problems and learning you will have in future weeks and months

    there are commercial tutorials online to teach such basics

    invest in your future
    its cheaper for all - and faster as well
     
    hans, Apr 17, 2007 IP
  11. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #11
    You mean like this?
    &nbsp;<?php phpinfo();?>
    HTML:
     
    Aragorn, Apr 17, 2007 IP
  12. prismmb

    prismmb Guest

    Messages:
    82
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    43
    #12
    I think there is no problem with Apache server because when I go to

    http://localhost/index.html.en then its showing index.html page of offline Apache installation.

    This is my path in local computer
    D:\Program Files\Apache Group\Apache\htdocs
    HTML:
    but when I go to http://localhost/test.php (File is there) so Instade of run this file they indicate us to download that file.

    So do I need to configure php.ini file to run php file from
     
    prismmb, Apr 17, 2007 IP
  13. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #13
    of course absolutely NO

    it appears you have still april 1
    i have zero sense for such jokes and waste of time

    NO space BEFORE the php code ...
    that means NO nbsp - NO blank however !!!

    ONE clean HTML page consisting of the traditional HTML elements

    html
    head
    /head
    body

    your code here

    /body
    /html

    in correct syntax of course

    obviously you have failed to configure apache for PHP
    that's why the page is offered for download instead of being displayed - that's a totally different story and way to basic.

    as said before
    its time to either change job - become baker, gardener, painter or whatever

    OR

    start learning the basics first
    but no more april fools HERE in dp forum - it's time to work for me an di have no more time for such jokes
     
    hans, Apr 17, 2007 IP
  14. jquindlen

    jquindlen Notable Member

    Messages:
    1,725
    Likes Received:
    112
    Best Answers:
    0
    Trophy Points:
    220
    Digital Goods:
    1
    #14
    When I installed php, I had to use <?PHP ?> for php code until I edited the php.ini file (I think, it could've been a different .ini) and then after that I was able to use <? ?>
     
    jquindlen, Apr 17, 2007 IP
  15. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #15
    you are talking about short tags in system php.ini

    it's a rather lazy method to use short tags ON
    default in professional SW should be short tags OFF
     
    hans, Apr 17, 2007 IP
  16. Valve-Hosting

    Valve-Hosting Peon

    Messages:
    1,071
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I'm not sure how you've managed to install Xampp without PHP running :S Xampp is made so everything is ready to go. I really have no idea whats happened.

    Are you running XAMPP on a remote box? It's not really made for that. If you tell me what Distro you're using I can give you a link for a fool-proof perfect set up ;)



    Also, typing PHP -v at the command prompt is the quickest way to see if it's installed, which it will be if you used xampp
     
    Valve-Hosting, Apr 17, 2007 IP
  17. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #17
    For getting the phpino all you need is the code
    <?php phpinfo();?>
    Code (markup):
    That was what I was trying to convey. And it was you who complicated the entire thing by asking me to try the code. I tried the code and I found no problem with it. Tats why I asked for clarification. I need no baby sitting. Thanks for the replies anyways.

    In your php.ini set the short_open_tag on
    short_open_tag = On
    Code (markup):
    If anybody needs help with installing Apache and PHP on Windows, feel free to pm me. I'll try my best to help you.
     
    Aragorn, Apr 17, 2007 IP