: 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.