Add pcntl extension in php (Linux)

Source: Internet
Author: User
: This article mainly introduces how to add the pcntl extension (Linux) in php. if you are interested in the PHP Tutorial, refer to it. Add pcntl extension in php (Linux)

Published one year ago () read (936) | comment (0)1Add this article to favorites

Like 0

January 10 # Changsha # registration of OSC source conference in stage 1

Add pcntl extension in php


The pcntl extension supports multiple threads in php (linux only)
The configrue prompt added -- enable-pcnt after PHP needs to be re-compiled.

Because my php is installed using yum, the above method cannot be used.
The following describes how to dynamically add extensions to php.
1. First, check the directory where the phpize Command is located (ps: My directory/usr/bin/phpize)
If not found, install
Yum install php53_devel (ps: pay attention to your version)
After installation. The phpize command is generated.
2. go to php.net to download the php source file of the corresponding version.
Let's take php-5.3.17 as an example, extract, enter the corresponding module
Cd ext/pcntl
# Run phpize first
/Usr/bin/phpize
./Configure -- with-php-config =/usr/bin/php-config (ps: Please specify the php-config directory correctly)
# Compilation and installation
Make & make install
An error occurred at this time.
./Configure compilation is normal, but make error
Error: 'php _ FE_END 'undeclared here (not in a function)
Solution:
Source code error, go to 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
Run make & make install again.
3. after compilation, a pcntl. so file is generated. In the php model Directory
Edit/etc/php. ini and add
Extension = pcntl. so
4. restart apache
Service httpd restart
5. test whether the installation is successful.
Echo pcntl_fork ();
?>
Output: 23165

The above describes how to add the pcntl extension (Linux) in php, including some content, and hope to help those who are interested in the PHP Tutorial.

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.