Recently I started to learn how to use php's pcntl to implement "Multithreading", while the company's LAMP environment does not have pcntl extension.
Recently I started to learn how to use php's pcntl to implement "Multithreading", but the company's LAMP environment does not have pcntl extension.
The following method is found on the Internet:
# Cd/usr/local/src/php-5.2.6/ext/pcntl
# Phpize
#./Configure -- with-php-config =/usr/local/php/bin/php-config
# Make & make install
Add the pcntl. so extension to php. ini.
The following is a brief analysis:
In the first line, we first enter the cd/usr/local/src/php-5.2.6/ext/pcntl Directory. by default, every extension of php downloaded has a directory, and you can choose partial compilation, it can be used in programming only after compilation.
In the second line, we generate a compilable file through phpize.
The third and fourth lines are our compilation process. after completion, a pcntl. so file will be generated.
The fifth line adds our pcntl. so extension to php. ini.
Note that you must check whether the directory location of the generated pcntl. so is consistent with the extension_dir = in php. ini. If they are inconsistent, move pcntl. so to the directory specified by extension_dir.
Of course, this is just an example using pcntl. This is roughly the case when you install other extensions of php.