-4

Issue Is with the database connection for an open source Project(PHP). Everything works fine apart from the database connection required for login. Following is the error that can be seen after login.

Warning: require_once(../mysqli_connect.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/airline-ticket-reservation-system-master/login_handler.php on line 44

Fatal error: require_once(): Failed opening required '../mysqli_connect.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/airline-ticket-reservation-system-master/login_handler.php on line 44

mysqli_connect.php

<?php
DEFINE('DB_USER','Harry');
DEFINE('DB_PASSWORD','passpasshello');
DEFINE('DB_HOST','localhost');
DEFINE('DB_NAME','airline_reservation');

$dbc=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME)
OR dies('Could not connect to MySQL:' .
    mysqli_connect_error());
?>

enter image description here

Community
  • 1
  • 1
  • 1
    The solution is in the error. File not found. Check the correct path of mysqli_connect.php(If that's a valid file) and apply it in the code. Also, please include the code which throws the error(In your case, login_handler.php -Line 44) – the.marolie Apr 24 '19 at 06:38
  • 2
    your `mysqli_connect.php` is under folder `MysqlDataConnection..` ,change your path to : `MySQLDataConnectionfile/mysqli_connect.php` – Swati Apr 24 '19 at 06:39
  • mysqli_connect.php is present in the subdirectory of the main project folder as seen on image https://i.stack.imgur.com/PK1gA.jpg . – Arindam Deka Apr 24 '19 at 06:40
  • sqli is under MySQL Database Connection file folder @Swati – Arindam Deka Apr 24 '19 at 06:42
  • So why are you trying to include `../mysqli_connect.php` then? – deceze Apr 24 '19 at 06:42
  • https://github.com/harryroshan/airline-ticket-reservation-system above is the project link .please have check and let me know.Much appreciated – Arindam Deka Apr 24 '19 at 06:43
  • @deceze Please include the correct path – Arindam Deka Apr 24 '19 at 06:44
  • 1
    Possible duplicate of [require\_once :failed to open stream: no such file or directory](https://stackoverflow.com/questions/5116421/require-once-failed-to-open-stream-no-such-file-or-directory) – Shadow Apr 24 '19 at 06:55
  • @Shadow negative. There are two object of the same but for different components only. And Also ../mysqli_connect.php line has been changed to direct path even now it is giving me the following error Warning: require_once(/Applications/XAMPP/xamppfiles/htdocs/airline-ticket-reservation-system-master/MySQL Database Connection file): failed to open stream: Undefined error: 0 in /Applications/XAMPP/xamppfiles/htdocs/airline-ticket-reservation-system-master/login_handler.php on line 42 – Arindam Deka Apr 24 '19 at 07:08
  • @ArindamDeka you need to figure out the right path yourself, that's the answer. – Shadow Apr 24 '19 at 07:10

1 Answers1

0

try to include the mysqli_connect file where the error occur

require_once(../MySql DatabaseConnection file/mysqli_connect.php)

reference

Community
  • 1
  • 1