PCNTL extension can support multi-threaded operation of PHP (Linux only)
Originally need to recompile PHP after configrue hint plus--enable-pcntl
Since my PHP is installed with Yum, I can't use the above method
Here's a way to dynamically add extensions to PHP phpize
1. First look at the directory where the Phpize command is located (ps: my directory/usr/bin/phpize)
If not found, perform the installation
Yum Install Php53_devel (PS: Please note your version)
After the installation is complete. The Phpize command is generated
2, go to php.net download the corresponding version of the PHP source files
Let's take php-5.3.17 as an example, after decompression, into the corresponding module
CD Ext/pcntl
#先执行phpize
/usr/bin/phpize
./configure--with-php-config=/usr/bin/php-config (PS: Please specify the directory of the Php-config correctly)
#编译, installation
Make && make install
There was a mistake.
./configure compile OK, but make error
Error: ' Php_fe_end ' undeclared here (not in a function)
Workaround:
Source code error, enter php-5.3.17 directory
Sed-i ' s| php_fe_end| {null,null,null}| ' ./ext/**/*.c
Sed-i ' s| zend_mod_end| {null,null,null}| ' ./ext/**/*.c
Re-make && make install
3. A pcntl.so file is generated when the compilation is complete. In the Model directory of PHP
Edit/etc/php.ini, join
Extension=pcntl.so
4. Restart Apache
Service httpd Restart
5. Test whether the installation is successful
<?php
Echo Pcntl_fork ();
?>
Output: 23165
Also attached:
The PCNTL extension can support multi-threaded operation of PHP.
Originally need to recompile PHP after configrue hint plus--enable-pcntl
For the sake of easy to compile and calculate birds directly.
# Cd/usr/local/src/php-5.2.6/ext/pcntl
# phpize
#./configure--with-php-config=/usr/local/php/bin/php-config
# Make && make install
pcntl.so Add to PHP.ini OK
Reprint Address: https://my.oschina.net/junn/blog/158616
PHP add pcntl Extension (Linux)