localhost/test.php returns nothing

39,693

You said that you put your script in /var/www/html

So the link might be

localhost/html/test.php

Also check the error log file for PHP error.

# cat /var/log/apache2/error.log

EDIT: Change your quote, ” are for Word document and not programming ;-)

<html>
 <head>
 <title>PHP Test</title>
 </head>
 <body>
 <p>This is an HTML line</p>
 <?php
    echo "This is a PHP line";
    phpinfo();
 ?>
 </body>
</html>
Share:
39,693
mOna
Author by

mOna

What does not kill you, makes you stronger!

Updated on November 19, 2020

Comments

  • mOna
    mOna over 3 years

    I am following a tutorial "PHP & MySQL for dummies" to build a web application. I created a simple test.php file in web space (/var/www/html). The problem is that when I type localhost/test.php in the browser address window, it returns me an empty page. I tried localhost/php.info and it worked well but I could not find why test.php does not work.

    This is the test.php code:

     <html>
     <head>
     <title>PHP Test</title>
     </head>
     <body>
     <p>This is an HTML line
     <p>
     <?php
        echo “This is a PHP line”;
        phpinfo();
     ?>
     </body></html>
    

    I do appreciate any information.

    Thanks.