Reputation: 35
I recently got back into programming in PHP and I've encountered a strange issue. Using session_start()
on any .php file causes the server to time out and return This webpage is not available
. I have Session Support and cookies both enabled.
Literally only this will time out my server:
<?php
session_start();
?>
I've used this code in the past to manage logins but I've only now had this problem. Has something changed? Am I doing something wrong? Thanks in advance.
Upvotes: 1
Views: 2086
Reputation: 21681
In PHP7, The options parameter was added for session_start().
See more about session configuration.
In addition to the normal set of configuration directives, a read_and_close
option may also be provided. If set to TRUE, this will result in the session being closed immediately after being read.
Perhaps 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.
You also checked that the use_strict_mode should be set to 1.
Upvotes: 1