После настройки по видео появились ошибки, что делать?
КУРС CODEIGNITER, урок 22 (Разграничение прав доступа к сайту. Подготовка), после настройки по видео появились ошибки. Всё сделано по уроку!!! Так же заменил файлы сайта на файлы из исходного кода - те же самые ошибки!!! Не могу дальше обучаться. Что делать? Ошибки указаны ниже:
A PHP Error was encountered
Severity: 8192
Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 132
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: 8192
Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 294
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: 8192
Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 168
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: 8192
Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 237
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: 8192
Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 317
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: 8192
Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 358
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 282
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 294
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 304
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 314
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 315
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 316
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 317
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 375
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 110
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_start(): Session cannot be started after headers have already been sent
Filename: Session/Session.php
Line Number: 143
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 32
Function: library
File: D:\xampp\htdocs\kinomonster\application\core\MY_Controller.php
Line: 6
Function: __construct
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 8
Function: __construct
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
7 ответов
Полностью менял! Что за дамп базы?
Благодарю!
Ошибку исправил (нашёл в вопросах) поменял местами //function __construct() на function DX_Auth() в файле "application > libraries > DX_Auth.php".
Но появилась новые ошибки и пока не нашёл решения:
A PHP Error was encountered
Severity: Warning
Message: Undefined property: DX_Auth::$ci
Filename: libraries/DX_Auth.php
Line Number: 758
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 758
Function: _error_handler
File: D:\xampp\htdocs\kinomonster\application\views\templates\menu.php
Line: 24
Function: is_logged_in
File: D:\xampp\htdocs\kinomonster\application\views\templates\footer.php
Line: 4
Function: view
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 20
Function: view
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: Attempt to read property "session" on null
Filename: libraries/DX_Auth.php
Line Number: 758
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line: 758
Function: _error_handler
File: D:\xampp\htdocs\kinomonster\application\views\templates\menu.php
Line: 24
Function: is_logged_in
File: D:\xampp\htdocs\kinomonster\application\views\templates\footer.php
Line: 4
Function: view
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 20
Function: view
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
An uncaught Exception was encountered
Type: Error
Message: Call to a member function userdata() on null
Filename: D:\xampp\htdocs\kinomonster\application\libraries\DX_Auth.php
Line Number: 758
Backtrace:
File: D:\xampp\htdocs\kinomonster\application\views\templates\menu.php
Line: 24
Function: is_logged_in
File: D:\xampp\htdocs\kinomonster\application\views\templates\footer.php
Line: 4
Function: view
File: D:\xampp\htdocs\kinomonster\application\controllers\Main.php
Line: 20
Function: view
File: D:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
Стоял XAMPP версии 8.1.2, поставил 7.1.10 (xampp-win32-7.1.10-0-VC14-installer.exe). Теперь и с исходным кодом и с тестовым index.php (<?php echo "Test"; ?>) доступ к сайту запрещен!
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
kinomonster.com
Apache/2.4.28 (Win32) OpenSSL/1.0.2l PHP/7.1.10
Нашёл решение: XAMPP надо ставить на C:\. У меня стоял на D:\ !
Так же заменил файлы сайта на файлы из исходного кода - те же самые ошибки!!!
Выборочно заменил файлы из исходного кода уроков или целиком весь код, включая дамп базы? Если нет, возьми код целиком и дамп базы, будет работать.
Попробуй XAMPP поставить с PHP ниже версии 8.1.
Тут есть как пофиксить ошибку, если использовать последнюю версию PHP:
Пробовал XAMPP с версией PHP ниже поставить?