09/10/2018, 23:58
Lỗi khi tạo Session.
Chào các bác, em vừa mới chuyển sang PHP thì gặp ngay cái lỗi này mà không biết tại cấu hình hay tại cú pháp, bác nào biết giúp đỡ 1 chút.
tạo vì dụ :
<?php
// page1.php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
No báo như sau :
Warning: session_start() [function.session-start]: open(C:PHPsessiondatasess_8463df462a455c9aace5e 3a73459f182, O_RDWR) failed: Permission denied (13) in D:PHPvidu1.php on line 4
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:PHPvidu1.php:4) in D:PHPvidu1.php on line 4
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:PHPvidu1.php:4) in D:PHPvidu1.php on line 4
Welcome to page #1
page 2
page 2
Warning: Unknown(): open(C:PHPsessiondatasess_8463df462a455c9aace5e 3a73459f182, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:PHPsessiondata) in Unknown on line 0
Xin chỉ giáo các pác. thanks !
tạo vì dụ :
<?php
// page1.php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
No báo như sau :
Warning: session_start() [function.session-start]: open(C:PHPsessiondatasess_8463df462a455c9aace5e 3a73459f182, O_RDWR) failed: Permission denied (13) in D:PHPvidu1.php on line 4
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:PHPvidu1.php:4) in D:PHPvidu1.php on line 4
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:PHPvidu1.php:4) in D:PHPvidu1.php on line 4
Welcome to page #1
page 2
page 2
Warning: Unknown(): open(C:PHPsessiondatasess_8463df462a455c9aace5e 3a73459f182, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:PHPsessiondata) in Unknown on line 0
Xin chỉ giáo các pác. thanks !
Bài liên quan
Cái thư mục C:\PHP\sessiondata này của bạn chắc là NTFS không cấp quyền ghi cho miss apache. Do đó cookie lưu session state của bạn không tạo được trong thư mục đó. Nó sẽ báo một warning:
------------
Cái header("Location") bị lỗi nguyên nhân giống 2 cái warn thứ 2 và 3.
kiểm tra bạn vao cmd gõ lệnh more file.php để xem có ký tự trắng trước nó không.