Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 288
mOna Avatar asked Sep 25 '26 13:09

mOna


1 Answers

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>
like image 74
OpenStark Avatar answered Sep 28 '26 01:09

OpenStark