Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multithreading in PHP

I recently read about http://php.net/pcntl and was woundering how good that functions works and if it would be smart to use multithreading in PHP since it isn't a core function of PHP.

I would want to trigger events that don't require feedback through it like fireing a cronjob execution manually.

All of it is supposed to run in a web app written with Zend Framework

like image 322
Thomaschaaf Avatar asked Feb 26 '09 14:02

Thomaschaaf


1 Answers

The pcntl package works quite fine - it just uses the according unix functions. The only shortage is that you can't use them if php is invoked from a web server context. i.e. you can use it in shell scripts, but not on web pages - at least not without using a hack like calling a forking script with exec or similar.

[edit] I just found a page explaining why mod_php cannot fork. Basically it's a security issue. [/edit]

like image 131
soulmerge Avatar answered Sep 20 '22 07:09

soulmerge