PCNTL extensions can support multithreaded operations in PHP (Linux only)
The original need to recompile PHP back configrue hint plus--enable-pcntl
Since my PHP is installed using yum, I can't use the above method
Here's how to add an extension to PHP dynamically phpize
1, first look at the phpize command in the directory (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, to php.net download the corresponding version of the PHP source file
Let's take php-5.3.17 for 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 Php-config directory correctly
#编译, install make
&& do install
There was a mistake.
./configure compile normal, 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. After compiling, a pcntl.so file will be generated. In the PHP model directory
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