简体   繁体   中英

session_start() causes server to run full execution time, then return data

I've got a small MVC application that I've been writing locally on my laptop with MAMP, and it runs fine - there's no issues, in fact, I've installed it on a GoDaddy server to use for a small project. I have an old computer in my house that I turned into an Ubuntu server with a LAMP installation and it works fine too. I looked around at questions online, but none seem to be the same situation.

I timed it; the page sits and loads for 60 seconds - the max execution time, and then displays. It's not a big site; at the moment it's literally a div with the word "demo" in it, some css and js. I sat and kept refreshing the access log on the server, and it doesn't add new records until the 60 seconds is up and the files are downloaded, so it's definitely not load time.

If I put die('asdf'); down the index file, it works until I hit session_start() . I have another virtual server on the box, and it works with no problems whatsoever (even uses sessions).

If I comment out sessions, it runs until it hits an anonymous function, but I think the root of all of it is sessions. The server is running PHP 5.3.6 so it shouldn't be an issue.

I originally thought it was the .htaccess file, but I managed to rule that out. I'm not the most server tech-savvy person out there, but I'm learning! I haven't modified anything with sessions on the server and so I can't imagine what's going to make it do this and not send any errors (everything is turned up as high as I can get it). I just feel like I should be getting a timeout error, not let it run and then sit until it times out. Again, the code works on two other servers so it's something on this server.

Thank you!

Try running a later version of PHP. I used to develop on MAMP with PHP 5.3.6, like you, and had some funky things happen (like closures not working with references properly).

I understand if your production environment cannot upgrade, but it would be worth a shot to see if it's a PHP problem or a script problem.

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