PHP add pcntl Extension (Linux)
Posted 1 years ago (2013-09-02 15:07) Read (936) | Comments (0)1 People collection This article, I want to collect
likes 0
January 10 #长沙 # OSC start 32nd
PHP Add pcntl Extension
PCNTL extension can support multi-threaded operation of PHP (Linux only)
Originally need to recompile PHP after configrue hint plus--enable-pcnt
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
Echo Pcntl_fork ();
?>
Output: 23165
The above describes the PHP add pcntl Extension (Linux), including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.