0

Now we are working on a small web application we started this with php but we have some requirement to create some threads in php, what are advantage and disadvantage of PHP threads . how php handling synchronisation for common data.

my requirement are given bellow

  1. User can create some background jobs.
  2. in each thread we want to create some child threads.
  3. in run time thread properties can be configurable
Midhun Pottammal
  • 1,107
  • 1
  • 11
  • 25
  • What about the manual ? http://php.net/manual/en/class.thread.php – Frederik.L May 18 '15 at 06:09
  • @Frederik.L ya i read that manual .. and i searched lot of blogs, i got only it possible, but no real world performance or nothing regarding PHP threads. – Midhun Pottammal May 18 '15 at 06:12
  • What do you mean by performance? What are your requirements? There are lots (lots!) of tutorials out there which deal with php threads. – davidgiga1993 May 18 '15 at 06:14
  • Too broad IMO. This question is about any information anyone could give about anything related to threads. There is no right answer neither complete answer to this question, hence I'd recommend improving the question so it actually asks something that can be answered. – Frederik.L May 18 '15 at 06:17
  • @davidgiga1993 can u share some links ,i am not a php developer ,for a particular requirement we choose php – Midhun Pottammal May 18 '15 at 06:26
  • Google "php threading tutorial". First entry: http://stackoverflow.com/questions/70855/how-can-one-use-multi-threading-in-php-applications – davidgiga1993 May 18 '15 at 06:27
  • @davidgiga1993 i seen lot of posts php threads are not working properly etc – Midhun Pottammal May 18 '15 at 06:35

2 Answers2

1

It is possible to use threads in PHP. The advantages/disadvantages are the same as in any other programming language.

Take a look at the manual for more information: http://php.net/manual/en/book.pthreads.php

davidgiga1993
  • 2,695
  • 18
  • 30
1

Yes, it is possible, Pthread library is what you need to use.

For windows:

You will have to install some dlls

For linux:

You might need to recompile php using zts because by default it is disabled or not installed.

Danyal Sandeelo
  • 12,196
  • 10
  • 47
  • 78