Home >Backend Development >PHP Tutorial >How to install PHP pcntl extension under linux
1. Download the same version of php (mine is php5.5.10, the one I downloaded is php5.5.10)
[root@CentOS6 lamp]# wget http://hk1.php.net/get/php-5.5.10.tar.gz /from/this/mirror
If your php version is different, please change it to wget http://hk1.php.net/get/php-x.x.xx.tar.gz/from/this/mirror
2. Unzip php:
[root@CentOS6 lamp]# tar -zxvf mirror
3. Enter php/ext/pcntl/
[root@CentOS6 php-5.6.28]# cd ext/pcntl/
4. Execute the command phpize
[root@CentOS6 pcntl]# /usr/bin/phpize Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226
5. Execute Configuration command php-config
[root@CentOS6 pcntl]# ./configure --with-php-config=/usr/bin/php-config
6, compile make && make install
[root@CentOS6 pcntl]# make && make install
may report an error:
Installing shared extensions: /usr/lib/php/modules /
make: Warning: Clock error detected. Your creation may be incomplete.
Solution:
Enter the php-5.6.28 directory
sed -i 's|PHP_FE_END|{NULL,NULL,NULL}|' ./ext/**/*.c sed -i 's|ZEND_MOD_END|{NULL,NULL,NULL}|' ./ext/**/*.c
Recompile:
[root@CentOS6 pcntl]# make && make install [root@CentOS6 pcntl]# make installInstalling shared extensions: /usr/lib/php/modules/
7. Modify php.ini to support pcntl
[root@CentOS6 pcntl]# echo "extension=pcntl.so" >> /etc/php.ini
8. Check phpinfo() to see if there is a pcntl extension;
Related recommendations:
About pcntl_fork in php multi-process Detailed introduction
Share PHP-pcntl to implement multi-process code
PHP uses pcntl and libevent to implement Timer function
The above is the detailed content of How to install PHP pcntl extension under linux. For more information, please follow other related articles on the PHP Chinese website!