Change language

What is thread safe or not thread safe in PHP?

Thread Safe:it is used to ensure that when a shared data structure manipulated by different threads cannot get into a race condition. Thread safety is recommended when the web server runs multiple threads of execution at the same time for different requests. The Thread Safety binary can run in the context of a multithreaded web server. Thread safety works by making a copy of local storage in each thread so that data does not collide with another thread. 
For example :
  • Apache + LoadModule
  • IIS
Not threaded -oriented:it does not check for thread safety, which makes it faster, but at the same time it becomes more unstable and crashes very often. This only applies to one thread. In the non-threaded version, binaries are widely used when communicating with a web server using the FastCGI protocol, without using multithreading. 
For example :
  • Apache + FastCGI
  • IIS + FastCGI
So this depends on how you want to use PHP. AFAIR running PHP with fastCGI is the preferred way. If you don’t know what version of PHP is installed on your system, there is an easy way to find out. 
Check the version of PHP Thread Safe or Non Thread Safe installed:
Open phpinfo() and find the Thread thread line for multithreaded build, which you should find enable.
  • On Windows:
    php -i | findstr "Thread" 
  • On * nix:
    php -i | grep Thread 
  • In both cases, any
    Thread Safety = > enabled // or Thread Safety = > disabled 

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

Common xlabel/ylabel for matplotlib subplots

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

12 answers

NUMPYNUMPY

Flake8: Ignore specific warning for entire file

12 answers

NUMPYNUMPY

glob exclude pattern

12 answers

NUMPYNUMPY

How to avoid HTTP error 429 (Too Many Requests) python

12 answers

NUMPYNUMPY

Python CSV error: line contains NULL byte

12 answers

NUMPYNUMPY

csv.Error: iterator should return strings, not bytes

12 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

sin

How to specify multiple return types using type-hints

exp

Printing words vertically in Python

exp

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

cos

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically