0

My script below is only displaying the text "Server Timestamp" to the web server, the date and nmap.html contents are not displayed:

<?php

echo "Server Timestamp: ";
echo date("h:i:sa");

echo "<pre>";
include("nmap.html");
echo "</pre>";

?>
  • The nmap.html file is populated with data and is in the same directory as the php script file (/var/www/html)
  • I have run this script through PHPcodechecker.com and received back "No issues found"
  • When I run the exact same script and server on an aws ubuntu ec2 instance everything works as desired.
  • sudo chmod 777 /var/www/html *

Any help would be much appreciated! Thanks!your text

  • Try `require_once("nmap.html")` and tell us what the error is. – Atena Dadkhah Mar 22 '23 at 17:32
  • Also, turn on error reporting and make sure to view source, not inspect, to see if there's anything else – Chris Haas Mar 22 '23 at 17:48
  • @AtenaDadkhah I get the same error from apache2 both before changing my code to what you wrote, and after:" [Wed Mar 22 10:32:50.669434 2023] [php:error] [pid 678] [client 127.0.0.1:32868] PHP Fatal error: Uncaught Error: Call to undefined function data() in /var/www/html/network.php:4\nStack trace:\n#0 {main}\n thrown in /var/www/html/network.php on line 4" – purpleglaciers Mar 22 '23 at 18:58
  • @ChrisHaas Thank you for your response. when you say error reporting is that something within apache2 that's different from just viewing the error.log file? – purpleglaciers Mar 22 '23 at 19:04
  • "Call to undefined function data" - note that that says `data` and not `date`. What you are seeing is the PHP error log which can be set to [different levels](https://www.php.net/manual/en/function.error-reporting.php) and can be configured to either [show and/or log errors](https://stackoverflow.com/a/21429652/231316). – Chris Haas Mar 22 '23 at 20:11

0 Answers0