Find the answer to your Linux question:
Results 1 to 6 of 6
i want to run test.php file <html> <body> <?php phpinfo(); ?> </body> </html> and save this file to location "/var/www/html" and i also edit the httpd.conf file and add the ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    4

    Unhappy php file not run

    i want to run test.php file

    <html>
    <body>
    <?php
    phpinfo();
    ?>
    </body>
    </html>

    and save this file to location "/var/www/html"

    and i also edit the httpd.conf file
    and add the module
    LoadModule php5_module modules/libphp5.so

    AddType application/x-httpd-php-source .phps
    AddType application/x-httpd-php .php
    AddType text/html .php

    and when type
    [htt://localhost/testphp] ,i shows nothing on the browser

    thanks

  2. #2
    Trusted Penguin Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,393
    Potentially lots of reasons why this might be. Could be filesystem permissions (check the man page for 'chmod'), or it could be an apache configuration not allowing you to run files from that directory (check the Apache docs and/or website to turn on PHP file execution), it could even be down to something as simple as your browser config.

    You could try changing the 'phpinfo()' call to one that does something much simpler, say 'Print("hello world")' or something like that to see what happens. You could even put in some html outside the php markers to see if you get that appearing when you run the page.

    The best source of help to find out what is going wrong, though is to look in the apache logs, probably /var/log/httpd/... Try your request then look at the last few messages in your log. If you cant work out what they mean, we can probably help.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    4
    i get following log

    127.0.0.1 - - [19/Aug/2009:02:19:19 +0530] "GET /crossdomain.xml HTTP/1.1" 404 324 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1"

  4. #4
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    because you didn't have the . in your URL.
    htt://localhost/testphp

    should be
    http://localhost/test.php

    also make sure the file is executable to apache user,
    chown apache:apache /var/www/html/test.php
    chmod 775 /var/www/html/test.php
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  5. #5
    Just Joined!
    Join Date
    Jun 2009
    Posts
    4

    Unhappy

    i already done this but i again get the blank page

  6. #6
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    try executing it on the command line, it will most likely give you the error message relevent (I found blank pages to usualy be PHP errors). just run it in bash

    /var/www/html/test.php

    but you need the #!/usr/bin/php or whatever your path is to the php interpreter up top. OR run

    php /var/www/html/test.php
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...