search
Homephp教程PHP开发Add pcntl extension to php in Linux system

Add pcntl extension to php in Linux system

Dec 22, 2016 pm 04:03 PM
pcntl extension

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:请注意自己的版本)

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

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();
?>

Output: 23165


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

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools