PHP session_start() causing HTTP requests to hang

2020-04-12 02:16发布

I have an application I've written in PHP from scratch. I'm using PHP's native session handler functions for handling user authentication and persistence.

When testing on the development server, everything is peachy. Authentication, persistence, etc, works fine.

When installed on the production server, everything works fine up until the user authentication -- when the app actually writes data to the session object, suddenly the HTTP request that follows it completely hangs exactly when session_start() is executed.

I suspected the temporary session files were being locked by PHP and never released, so I tried following up the spots where the app is writing to the session object with session_write_close(), but that didn't seem to have any effect.

Does this sound like a file lock issue or is this something else? I'm confused on why session_write_close doesn't seem to be taking care of the file lock issue if that's the case, which is why I'm wondering if there could be something else at play here.

Any possible thoughts or ideas?

Reply to Pekka's great suggestions:

  • The production server is a linux environment. phpinfo reports Linux wynn 2.6.18-164.9.1.el5PAE #1 SMP
  • The page is not calling itself
  • I can read/write the session folder and files. I can see the authentication data that gets serialized into the files from the auth attempt.

标签: php session
1条回答
家丑人穷心不美
2楼-- · 2020-04-12 02:41

Just a few ideas - in addition to pygorex's comment to first turn up the error_reporting, which should definitely come first.

查看更多
登录 后发表回答