简体   繁体   中英

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.

I am using 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
please also make sure you have php.ini with correct settings.
create an index.php and echo phpinfo(); ensure all required services is on.

Here is the solution, it's XAMPP bug and they are currently fixing it. If that didn't work, try to wait for XAMPP 7.0.2 or downgrade until fix comes out.

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. 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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