Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4004248
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:15:01+00:00 2026-05-20T08:15:01+00:00

I am battling with race condition protection in PHP. My application is written in

  • 0

I am battling with race condition protection in PHP.

My application is written in symfony 1.4 and PHP locks session data until a page completes processing. I have a long running (~10 second) login script and I want to display a progress bar showing the user what is being done while they wait. (I want to actually display what is being done and not use a standard [faux] loading bar.)

Whenever a script calls session_start(), PHP locks that user’s session data until that script completes. This prevents my status check ajax calls from returning anything until the longer running script completes. (My question on why my ajax calls were not asynchronous is here.)

I have devised a way to do this but I want to make sure this way is secure enough for general purposes (i.e.- this is not a banking application).

My idea is:

  1. On authentication of username & password (before the long login script starts), a cookie is set on the client computer with a unique identifier.
  2. This same unique identifier is written to a file on the server along with the client IP address.
  3. While the long login script runs, it will update that file with the status of the login process.
  4. The ajax status check will ping the server on a special page that does not use session_start(). This page will get the cookie value and the client IP and check the server side file for any status updates.

Are there any glaringly obvious problems with this solution?

Again, from the security angle, even if someone hacked this all they would get is a number representing the state of the login progress.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:15:01+00:00Added an answer on May 20, 2026 at 8:15 am

    I don’t see anything inherently wrong with the approach that you are proposing.

    But if your machine has APC installed you can use apc_store and apc_fetch to store your status in a sort of shared memory instead of writing to disk. Use something like apc_store(SID, 'login not started') to initialize and update the request state in memory, then apc_fetch(SID) to retrieve it on subsequent requests.

    There are other shared memory systems, including Apache, or even a database connection might be simpler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been battling PHP's email reading functions for the better part of two days.
I am battling an issue in which my application crashes while launching. When trying
I'm battling out of memory issues with my application and am trying to get
Hey, I've been battling with PHP all morning and it's now really starting to
I'm battling to understand the problem I'm having with Core Data and a simple
I've been battling with this for a while, I'm not familiar with PHP syntax,
I've been battling to set up my Symfony project on a IIS web server,
I'm having this problem with page layout that I've been battling for too long
I am battling regular expressions now as I type. I would like to determine
I've been battling for two days tracking down a mysterious error when compiling an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.