Thread and Non Thread Safe PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
devarishi
Forum Contributor
Posts: 101
Joined: Fri Feb 05, 2010 7:15 pm

Thread and Non Thread Safe PHP

Post 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.
User avatar
Weiry
Forum Contributor
Posts: 323
Joined: Wed Sep 09, 2009 5:55 am
Location: Australia

Re: Thread and Non Thread Safe PHP

Post by Weiry »

1: Wikipedia is awesome - Thread Safety

As for PECL, i haven't looked into them before, sorry.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Thread and Non Thread Safe PHP

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Thread and Non Thread Safe PHP

Post 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.
Post Reply