PHP add pcntl Extension (Linux)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.