Home php教程 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:请注意自己的版本)
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!

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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)