Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable thread safety in PHP?

I am using some software that requires me to have thread safety disabled. I am working on a Windows server. From what I've read elsewhere, I can't just configure this in the .ini file. Is this true? If so, how would I compile it so that thread safety is turned off?

like image 325
Paul Erdos Avatar asked Aug 06 '10 15:08

Paul Erdos


People also ask

What is PHP thread safety?

What does thread safety mean when downloading PHP? Thread Safety means that binary can work in a multithreaded webserver context, such as Apache 2 on Windows. Thread Safety works by creating a local storage copy in each thread, so that the data won't collide with another thread.

How do I know if PHP is thread safe?

If you are unknown which version of PHP is installed in your system then there is an easy way to know that. Check the version of installed PHP Thread safe or Non Thread Safe: Open a phpinfo() and search for the line Thread safety for a thread-safe build you should find enable.

What is not thread safe in Java?

It means when multiple threads executing simultaneously, and want to access the same resource at the same time, then the problem of inconsistency will occur. so synchronization is used to resolve inconsistency problem by allowing only one thread at a time. Synchronization uses a synchronized keyword.


2 Answers

You have to compile PHP with ZTS disabled (compile flag --disable-zts) or download binaries with ZTS disabled.

This won't work properly in some webservers, namely those which process several PHP scripts simultaneously in the same process.

like image 64
Artefacto Avatar answered Sep 28 '22 08:09

Artefacto


You can download compiled non-thread-safe binaries of PHP for Windows from

  • http://windows.php.net/download/
like image 23
Gordon Avatar answered Sep 28 '22 08:09

Gordon