I want to run php on a coreI7 computer system. is there any way to run the php on 64bit mode and use all capability of cores + hyperthread enabled.
-
1possible duplicate of [How do you make good use of multicore CPUs in your PHP/MySQL applications?](http://stackoverflow.com/questions/2267345/how-do-you-make-good-use-of-multicore-cpus-in-your-php-mysql-applications) – Patrick Desjardins Oct 05 '11 at 21:02
3 Answers
PHP does not support creating threads.

- 310,957
- 84
- 592
- 636
-
1But the question was never about threads only. With multiple processes you can "use all capabilitiy of cores" too (if not better, because there is no shared-memory-overhead). – KingCrunch Oct 09 '11 at 00:37
You can fork new processes with pcntl_fork, but this is often not possible or practical when running in a web context, since in most Apache+PHP configurations you'll end up with forking Apache which will fail or give undefined behaviour.
On the other hand, each Apache process will automatically be scheduled for one of the cores, and they will end up on different cores anyway. So there's still use for multicore even in a web context.

- 90,431
- 16
- 141
- 175
Like always: Depends on the application, but usually no. There are not that much applications out there (in any language), that make use of more than one core, than you might expect.
However, PHP is designed as "run and die", means: Usually it runs only once and then terminate. This means, that additional processes are usually not required and maybe would slow down the whole execution (process creation and stuff). There are some functions, that allows you to create multi-process applications, but I don't think, that you have an idea for an application, where this is useful.

- 128,817
- 21
- 151
- 173