mOna mOna - 17 days ago 9
PHP Question

localhost/test.php returns nothing

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.

Answer

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>
Comments