Jump to content

Multithreading in PHP?


vijay

Recommended Posts

Hi.. Is multithreading possible with php..? if yes then is there any understandable code. have refer some sites but @ there: no support for it but still we can have it via forking process or functions like pcntl_fork,pcntl_exec,.. is there any asmple code which will be run perfactly..?Thanks & Best Regards,Vijay

Link to comment
Share on other sites

Yes, multithreading is possible with PHP. But, due to the fact that web servers are multithreaded..

Process Control should not be enabled within a web server environment and unexpected results may happen if any Process Control functions are used within a web server environment.
The process control functions in PHP like fork are for Unix system programming, they would be for PHP console applications run on a Unix machine. They should not be used with a web server, and they do not work under Windows. If you still want to look into this, there is an example of forking a child process on this page:http://www.php.net/manual/en/ref.pcntl.phpIf you've never worked with multithreading, shared memory, or inter-process communication, you will want to do some studying and research first. Concepts like these are not something you can understand just by looking at example code, and even a tutorial would be a stretch. A pretty good understanding of how a processor executes a process is required to be able to take advantage of things like multithreading, and you also need to understand signal handling and things like semaphores if you want the threads to be able to access the same memory.
I don't understand what you mean. Sorry.
You probably don't need to respond..
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...