【发布时间】:2016-03-03 12:38:10
【问题描述】:
我正在尝试使用 session_start() 函数启动会话。我正在使用xampp的服务器。但是每当我包含此代码时,页面都不会加载。如果我删除此代码,页面将完美加载。 xampp有问题吗? 这是放置在文件最开头的代码,在 php 标记之前没有任何空格。
<?php
// Start the session
session_start();
?>
有人可以帮我吗?
这是 Apache 日志所说的:
[Fri Mar 04 19:13:09.822907 2016] [mpm_winnt:notice] [pid 5444:tid 508] AH00428: Parent: child process 7200 exited with status 3221225477 -- Restarting.
[Fri Mar 04 19:13:10.738482 2016] [ssl:warn] [pid 5444:tid 508] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Mar 04 19:13:10.800485 2016] [mpm_winnt:notice] [pid 5444:tid 508] AH00455: Apache/2.4.18 (Win32) OpenSSL/1.0.2e PHP/7.0.0 configured -- resuming normal operations
[Fri Mar 04 19:13:10.800485 2016] [mpm_winnt:notice] [pid 5444:tid 508] AH00456: Apache Lounge VC14 Server built: Dec 9 2015 10:17:39
[Fri Mar 04 19:13:10.800485 2016] [core:notice] [pid 5444:tid 508] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Mar 04 19:13:10.805024 2016] [mpm_winnt:notice] [pid 5444:tid 508] AH00418: Parent: Created child process 5404
[Fri Mar 04 19:13:12.067176 2016] [ssl:warn] [pid 5404:tid 532] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Mar 04 19:13:12.337492 2016] [ssl:warn] [pid 5404:tid 532] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Mar 04 19:13:12.400429 2016] [mpm_winnt:notice] [pid 5404:tid 532] AH00354: Child: Starting 150 worker threads.
【问题讨论】:
-
错误是什么?使用
error_reporting(E_ALL)并发布错误 -
在您的 php.ini 文件中添加 session.autostart = On
-
还要检查 session.use_cookies=1
-
“500 内部服务器错误”状态码(或空白页)表示您的脚本正在抛出错误,但您尚未配置 PHP 以显示错误消息。这是您在更进一步之前需要解决的问题;如果没有错误消息的帮助,就不可能正确编码。这是brief explanation。错误报告的经验法则是:在开发中显示,在生产中登录。
标签: javascript php html web