简体   繁体   English

当我使用session_start()时,Xampp 7.0.1 Apache崩溃

[英]Xampp 7.0.1 Apache crashes when I use session_start()

When I start a session using session_start() in PHP my Apache server just stops working. 当我在PHP中使用session_start()启动会话时,我的Apache服务器就停止工作了。

I am using Xampp 7.0.1 for Windows. 我正在使用Xampp 7.0.1 for Windows。

My config file looks like this: 我的配置文件如下所示:

<?php
error_reporting(E_ALL);

//session_start();
//ob_start();

header('Content-Type: text/html; charset=utf-8');

//Rest of the code
?>

Even if I put it on the first line of the file it doesn't work. 即使我把它放在文件的第一行,它也不起作用。

Does anybody know how to fix this? 有人知道如何解决这个问题吗?


The weird thing is that it is only happening in this specific map structure. 奇怪的是,它只发生在这个特定的地图结构中。

ie

C:\xampp\htdocs\functions\*

In for example: 例如:

C:\xampp\htdocs\test\*

It works fine. 它工作正常。

I think first of all you should set session.save_path in your php.ini 我想首先你应该在你的php.ini中设置session.save_path
please also make sure you have php.ini with correct settings. 另请确保您的php.ini设置正确。
create an index.php and echo phpinfo(); 创建一个index.php和echo phpinfo(); ensure all required services is on. 确保所有必需的服务都已启用。

Here is the solution, it's XAMPP bug and they are currently fixing it. 是解决方案,它是XAMPP错误,他们正在修复它。 If that didn't work, try to wait for XAMPP 7.0.2 or downgrade until fix comes out. 如果这不起作用,请尝试等待XAMPP 7.0.2或降级,直到修复程序出来。

we have been checking the configuration of XAMPP and we found that the issue is related to the use_only_cookies variable that you can find in the Session's section of the php.ini file. 我们一直在检查XAMPP的配置,我们发现这个问题与你可以在php.ini文件的Session部分找到的use_only_cookies变量有关。 Apache will crash if the use_only_cookies variable in the Session's section is set to 0 and everything is fine if it's set to 1. 如果Session的section中的use_only_cookies变量设置为0,Apache将崩溃,如果设置为1则一切正常。

http://php.net/manual/en/session.configuration.php#ini.session.use-only-cookies http://php.net/manual/en/session.configuration.php#ini.session.use-only-cookies

We also checked that the use_strict_mode should be set to 1. 我们还检查了use_strict_mode应该设置为1。

https://wiki.php.net/rfc/strict_sessions http://php.net/manual/en/session.configuration.php#ini.session.use-strict-mode https://wiki.php.net/rfc/strict_sessions http://php.net/manual/en/session.configuration.php#ini.session.use-strict-mode

We'll include those changes in the next version of XAMPP with PHP 7. We are building the installers with the version 7.0.2 and we'll release them as soon as possible. 我们将在PHP 7的下一个版本的XAMPP中包含这些更改。我们正在使用7.0.2版本构建安装程序,我们将尽快发布它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM