问题
I've recently switched from years of WAMP to XAMPP because I wanted PHP 7, but I've noticed something I've never experienced before, it wont load php files that have session_start();
in them. I just get "Waiting for localhost..." in Chrome/IE/FF. As soon as I remove that line the page loads.
Worked fine in wamp.
Basically every page that contains session_start();
wont load, super weird. But if I remove it, they load and show.
Why?
error log just notices
[Sun Dec 27 02:52:19.346602 2015] [mpm_winnt:notice] [pid 3272:tid 372] AH00455: Apache/2.4.18 (Win32) OpenSSL/1.0.2e PHP/7.0.0 configured -- resuming normal operations
[Sun Dec 27 02:52:19.346602 2015] [mpm_winnt:notice] [pid 3272:tid 372] AH00456: Apache Lounge VC14 Server built: Dec 9 2015 10:17:39
[Sun Dec 27 02:52:19.346602 2015] [core:notice] [pid 3272:tid 372] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun Dec 27 02:52:19.348604 2015] [mpm_winnt:notice] [pid 3272:tid 372] AH00418: Parent: Created child process 2744
[Sun Dec 27 02:52:19.607869 2015] [ssl:warn] [pid 2744:tid 380] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 27 02:52:19.674491 2015] [ssl:warn] [pid 2744:tid 380] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 27 02:52:19.699518 2015] [mpm_winnt:notice] [pid 2744:tid 380] AH00354: Child: Starting 150 worker threads.
EDIT: just found this, I have the exact same problem. he never found a solution
session_start() keeps the file load forever
EDIT2: I went back to WAMP and installed php7 myself
回答1:
Find in php.ini:
session.use_only_cookies=0
change to:
session.use_only_cookies=1
I had the same trouble with the latest XAMPP version 7.0.1 with php7.
According to Bitnami Developers via Apache Friends Support:
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.
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.
Hope this helps.
回答2:
I've included this in my header.php
<?php session_start(); ?>
and that works fine with the latest version of XAMPP with the Apache and MySQL modules running.
回答3:
I had the same problem, I just uninstall and install the 5.6.15 XAMPP version and the problem was solved, I thought that it was my Windows 8.1, but apparently there is a bug in 7.0.0
回答4:
Run XAMPP as administrator. I just figured it out by going to this website:
https://teamtreehouse.com/community/solved-xampp-apache-error
来源:https://stackoverflow.com/questions/34476922/pages-wont-load-if-it-has-session-start-in-it