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

  • Home
  • SEARCH
  • 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 8936547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:14:17+00:00 2026-06-15T10:14:17+00:00

Is it possible, in my PHP 5.4.0 application (IIS, FastCGI, Non thread safe) for

  • 0

Is it possible, in my PHP 5.4.0 application (IIS, FastCGI, Non thread safe) for two people to update the same table in the database by running the same code at exactly the same time and inadvertently mess up each other’s data?

The reason I ask is because I see the occasional unexplained data glitch, and in the most recent case I found that another customer updated the same table at exactly the same time.

And part two of my question is if this is indeed happening, how do I prevent it?

  • 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-06-15T10:14:19+00:00Added an answer on June 15, 2026 at 10:14 am

    They can’t “mess up each others data” because of non-thread safe PHP, no, unless you’re readying/writing Apache settings (e.g. with SetLocale) or you’ve programmed it to update shared information simultanously (e.g. flat files, as Amadam says).

    Most normal processes such as MySQL, reading GET parameters etc will not be affected.

    So unless your problem is with locales, it’ll be your code, not the thread settings.

    If it’s with SetLocale, then transactions or other methods won’t make any difference. Anyhting else you can program round.


    You can mess up data if you’ve not programmed for concurrent actions – this can happen in thread safe and non-thread safe. Remember that even in “thread safe” you can have concurrent threads being processed with different speed and orders.

    Here is a dangerous example:

    • Statement a) Read a table to get next update value
    • Statement b) Write to table using previous value
    • Statement c) Update “next update” table for next user.

    The statements could be processed by “User 1” running all, followed by “User 2” (ideal, and how you programmed it). But equally so, “User 1” runs “a” and “b”, followed by “User 2” running all, then “User 1” running “c” – in this case, “User 2” will overwrite what “User 1” wrote.

    (To repeat, this is NOTHING to do with “non-thread safe” in PHP.)

    How to get around this latter issue:

    1. Transactions MAY help you; they won’t actually help with the example above unless you use the “WITH CONSISTENT SNAPSHOT” option as all they do is delay the commit, and you’ve read the value too early in statement “a”.
    2. Table locks allow you to prevent users reading or writing to a table, so in the example above, lock the “update” table first, run the transations then release the lock. This forces the second user to wait until “User 1” has completed the lot before it reads the number.
    3. Use the capabilities of mySQL including “AUTO INCREMENT” primary keys, or codes such as “INSERT INTO… ON DUPLICATE KEY” or “REPLACE”.

    The third option is the best, if you can. Table locks can get messy and transactions my not fix your issues.

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

Sidebar

Related Questions

Is it possible to register .php as a .net extension in IIS 7.5? This
Is it possible to make a PHP application think that the server datetime is
In my PHP application, I have a mysql table of articles which has the
Basically I have two applications: a PHP web application that runs over Apache and
I am working on a PHP application that finds all possible ways to swap
So I have a PHP application running on linux machine which is using a
Can we run php and MVC 3 application under single IIS 7. I have
Possible Duplicate: How to detect if JavaScript is disabled? In my php application i
I am developing a php application. Is it possible to get active sessions and
Possible Duplicate: Make PHP execute and communicate with a Java application on a web

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.