I'm doing a simple project on raspberry Pi where I created a table of login in Mysql database where i write login username and password I created HTML and PHP in var/www/html and the HTML page work properly but when i try to log in i get
This page isn’t working192.168.1.26 is currently unable to handle this request. HTTP ERROR 500 on the PHP page
I tried to restart apache2 by sudo service apache2 start
but I get
Job for apache2.service failed because the control process exited with an error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
- My database show results
- I didn't grant any privileged
- my PHP shows when I typed my IP
- when I try to access any database in PHPMyAdmin it shows at the bottom
mysqli::real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@' Connection for controluser as defined in your configuration failed.localhost' (using password: YES)
my php code
<?php
$host="localhost";
$username="root";
$password="(my mysql root password)";
$db_name="ssn"; #name of my data base
$tbl_name="login"; # my table name
$conn = mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$myusername=$_POST['usr'];
$mypassword=$_POST['pwd'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="select * from $tbl_name where passwd='$mypassword' AND name='$myusername'";
$result=mysql_query($sql,$conn);
$count=mysql_num_rows($result);
if ($count == 1)
{
echo ":) :) LOGIN SUCCESS :) :) ";
}
else
{
echo ":( :( AUTHETICATION FAILURE :( :( ";
}
?>
#My html code
<html>
<body>
<form method="post" action="logindb.php">
UserName:<input type="text" name="usr"><br><br>
Password:<input type="password" name="pwd"><br><br>
<center><input type="submit" name="sub" value="Login"/></center><br><br>
</form>
</body>
</html>
i tried to run sudo systemctl status apache2
to know the issue and i got this
sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-05-29 02:56:28 CET; 1min 2s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 3485 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
CPU: 125ms
May 29 02:56:28 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited, s>
May 29 02:56:30 raspberrypi apachectl[3488]: AH00558: apache2: Could not reliably determine the>
May 29 02:56:30 raspberrypi apachectl[3488]: (98)Address already in use: AH00072: make_sock: co>
May 29 02:56:30 raspberrypi apachectl[3488]: (98)Address already in use: AH00072: make_sock: co>
May 29 02:56:30 raspberrypi apachectl[3488]: no listening sockets available, shutting down
May 29 02:56:30 raspberrypi apachectl[3488]: AH00015: Unable to open logs
May 29 02:56:28 raspberrypi systemd[1]: apache2.service: Failed with result 'exit-code'.
May 29 02:56:30 raspberrypi apachectl[3485]: Action 'start' failed.
May 29 02:56:30 raspberrypi apachectl[3485]: The Apache error log may have more information.
May 29 02:56:28 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
lines 1-17/17 (END)...skipping...
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-05-29 02:56:28 CET; 1min 2s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 3485 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
CPU: 125ms
May 29 02:56:28 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
May 29 02:56:30 raspberrypi apachectl[3488]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerN>
May 29 02:56:30 raspberrypi apachectl[3488]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
May 29 02:56:30 raspberrypi apachectl[3488]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
May 29 02:56:30 raspberrypi apachectl[3488]: no listening sockets available, shutting down
May 29 02:56:30 raspberrypi apachectl[3488]: AH00015: Unable to open logs
May 29 02:56:28 raspberrypi systemd[1]: apache2.service: Failed with result 'exit-code'.
May 29 02:56:30 raspberrypi apachectl[3485]: Action 'start' failed.
May 29 02:56:30 raspberrypi apachectl[3485]: The Apache error log may have more information.