N
N
Name Imechko2015-10-18 11:25:22
PHP
Name Imechko, 2015-10-18 11:25:22

Warning and Fatal error?

Warning: require_once(core/config.php): failed to open stream: No such file or directory in D:\WebServer\OpenServer\domains\localhost\administrator\index.php on line 2

Fatal error: require_once(): Failed opening required 'core/config.php' (include_path='.;d:/webserver/openserver/modules/php/PHP-5.6;d:/webserver/openserver/modules/php/PHP-5.6/PEAR/pear') in D:\WebServer\OpenServer\domains\localhost\administrator\index.php on line 2

<?php

define('MYSQL_SERVER', 'localhost');
define('MYSQL_USER', 'root');
define('MYSQL_PASSWORD', '');
define('MYSQL_DATABASE', 'site');

function db_connect() {
  $db_connect_link = mysqli_connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE)
    or die("Ошибка: ".mysqli_error($db_connect_link));
  if (!mysqli_set_charset($db_connect_link, "utf8")) {
    printf("Ошибка: ".mysqli_error($db_connect_link));
  }
}

?>

<?php
  require_once('core/config.php');
  require_once('templates/header.tpl');
?>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<?php require_once('templates/footer.tpl'); ?>

What are the errors...? All files are there...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2015-10-18
@Elem3nt071

path core/config.php :
in /index.php is equal to DOCUMENT_ROOT/core/config.php
in /admin/index.php is equal to DOCUMENT_ROOT/admin/core/config.php
it is clear that it cannot be found.
either use absolute paths, or change relative paths in /admin/index.php .

O
Optimus, 2015-10-18
Pyan @marrk2

In the manual, the path to the file is written in quotes:
require_once('echo.php');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question