Search code examples
phpapachexampp

Localhost blank page PHP


When i open my created Program.php(

<<?php echo "Hello World!" ?>

) file, then the "http://localhost/Program.php" page doesn't show the "Hello World" output. It just shows a blank page.

When i look in the sourcecode of the page, then it shows me

<Hello World!

Also when i run C:\xampp\php\php-cgi.exe C:\xampp\htdocs\Program.php in the command prompt, then it shows me the same output <Hello World!"

When i open the "http://localhost/" then it shows me the welcome page of xampp.

"http://Localhost\phpinfo.php" send back 404 not found.

Please help to fix this issue


Solution

  • In Program.php, you have extra < sign in front

    <<?php echo "Hello World!" ?>
    

    try:

    <?php echo "Hello World!"; ?>
    

    Regarding phpinfo.php

    404 genereally means page not found. So make sure that file exists at root of your server.

    If your server runs at: /var/www then your file path should be /var/www/phpinfo.php