Home > php教程 > PHP开发 > body text

Add pcntl extension to php in Linux system

高洛峰
Release: 2016-12-22 16:03:16
Original
1467 people have browsed it

pcntl extension can support multi-threaded operation of php (linux only)

Originally, you need to recompile PHP and add --enable-pcntl to the configure prompt later

Since my php is installed using yum, I cannot use the above Method

The following introduces a way to dynamically add extensions to phpize

1. First look at the directory where the phpize command is located (ps: my directory/usr/bin/phpize)

If not found, execute the installation

yum install php53_devel  (ps:请注意自己的版本)
Copy after login

After installation is completed. The phpize command will be generated

2. Go to php.net to download the corresponding version of the php source file

Let’s take php-5.3.17 as an example. After unzipping, enter the corresponding module

cd ext/pcntl
#先执行phpize
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config  (ps:请正确的指定php-config的目录)
#编译、安装
make && make install
Copy after login

At this time An error occurred

./configure compiled normally, but make error
error: 'PHP_FE_END' undeclared here (not in a function)

Solution:

There is an error in the source code, enter the 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. It will be generated after compilation is completed A pcntl.so file was created. Edit /etc/php.ini in the php model directory and add


extension=pcntl.so

4. Restart apache

service httpd restart

5. Test whether the installation is successful

<?php
  echo pcntl_fork();
?>
Copy after login

Output: 23165


For more articles related to adding pcntl extension to php in Linux system, please pay attention to PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!