Cannot get php file to run in browser? Ubuntu

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am trying to run a .php file that reads information from a MySQL database. I have installed php5:

developer@alchemy:~/dev$ php --version
PHP 5.3.10-1ubuntu3.13 with Suhosin-Patch (cli) (built: Jul  7 2014 18:52:09) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

I have apache2 installed and running:

developer@alchemy:~/dev$ sudo netstat -ntlup
[sudo] password for developer: 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN        1224/mysqld     
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      30018/apache2   

Here is the Display.php file:



Display udp packet
<style type="text/css">
body {
  background-color: #29C;
}
.display-box {
  border: solid 2px #FFF;
  padding: 10px;
  border-radius: 4px;
}

style>




Data: table "data" $result = mysqli_query($dbcnx, "SELECT * FROM data"); #temporary test display echo "

$data

"; # while($row = mysqli_fetch_array($result)) { # echo $row['packetdata'] . " " . $row['date']; # } #mysql_close($dbcnx); ?>

The file is found in the pathway /home/developer/dev/Display.php The method I found online to display the php file was to type into the search bar:

http://localhost/where/file/is/saved/Display.php

This however, returns a

"Not Found

The requested URL /display.php was not found on this server." Message. How do I run the php file? Have I missed something out?

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.