Due to language features and applicable scenarios, PHP's Distributed Transaction implementation is not as mature as Java.
If you want to implement distributed transactions using PHP,
1. Refer to the atomikos project atomikos,
The solution instructions can be downloaded and read from the following resources:
Http://download.csdn.net/detail/iefreer/5148135
This is an open-source Java implementation of distributed transactions.
In addition, you need to read relevant XA/JTA content to learn more about distributed transactions.
Basically, two-phase commit 2-phase-commit (2 PC) is not hard to understand theoretically:
- All participating systems will be asked if they can be submitted
- All these systems must answer this question, yes or no, Which means that from that moment on, the submission can pass
- Execute the commit when all systems are okay. That's all.
- In case of a system problem, all systems must be synchronized and rolled back.
- The coordination system requires that a response be returned within a specific period of time. Otherwise, the response is considered as a negative answer.
2, you can also look at the LIXA Transaction Manager (http://sourceforge.net/projects/lixa)
Starting from 0.9.0, it integrates PHP and MySQL.
It provides distributed transaction processing, including the implementation of the two-phase commit function.
By iefreer