Page 1 of 1

Thread and Non Thread Safe PHP

Posted: Fri Feb 19, 2010 5:21 pm
by devarishi
Hi,


On the download page here: http://windows.php.net/download/

there are "Thread" and "Non Thread" Safe versions of PHP.

I am curious to know about the differences in them.

One more thing: What are these PECLs are for here: http://downloads.php.net/pierre/ How to use them?

Here are more of them: http://pecl.php.net/packages.php

Regards,
Dev.

Re: Thread and Non Thread Safe PHP

Posted: Fri Feb 19, 2010 5:50 pm
by Weiry
1: Wikipedia is awesome - Thread Safety

As for PECL, i haven't looked into them before, sorry.

Re: Thread and Non Thread Safe PHP

Posted: Fri Feb 19, 2010 5:55 pm
by AbraCadaver
devarishi wrote:Hi,


On the download page here: http://windows.php.net/download/

there are "Thread" and "Non Thread" Safe versions of PHP.

I am curious to know about the differences in them.

Threads operate in a shared memory space and have access to the memory of other threads, so special care must be taken by the program so as not to step on the memory of other threads among other things. So thread safe means that the program can simultaneously operate with other threads and not interfere with other threads. Overall, PHP hasn't shown to be thread safe. It depends upon how you run it (CGI or Apache mod, etc.) and if the extensions (PECL or other) are thread safe as well. I would recommend non thread safe in most instances.

One more thing: What are these PECLs are for here: http://downloads.php.net/pierre/ How to use them?

PECL are extensions to PHP. Additional functionality that you may need that sometimes can be compiled in PHP and sometimes not, like an interface to some database or file compression, etc. Normally to use them you can install the extension in your PHP extensions directory and load it in php.ini. Sometimes you need to also install other libraries in the system. These can be downloaded as a binary and enabled in php.ini or you can use the pecl command line utilty to fetch and build them.

Here are more of them: http://pecl.php.net/packages.php

I think this is a listing of the sources of the PCL extensions, that when you use pecl from the command line, these packages will be downloaded, compiled and installed.

Regards,
Dev.

Re: Thread and Non Thread Safe PHP

Posted: Fri Feb 19, 2010 6:16 pm
by Eran
* Thread safety is only applicable to Windows, so as long as you don't install this verion on your production machine it shouldn't make a difference to you (likely it is a linux machine). If you're interested to find out more, read this following - http://www.iis-aid.com/articles/my_word ... e_binaries

* PECL, acronym - PHP Extension Community Library. Those extensions are complied in C which give then a significant performance benefit over PHP code. You can migrate PHP code to such an extension when it becomes a bottleneck and you need to optimize, or use existing PECL extensions to receive additional functionality not provided in the PHP core.

The first PECL link in your posts links to PECL extensions compiled for Windows. The PECL site (the second link) only contains the C source code which you would need to compile yourself in order to use it.