DEV Community

Krixnaas
Krixnaas

Posted on

3 1

How to enable PCNTL on Ubuntu server 16.04

for ubuntu 18 and 20: [replace 7.4.28 with your php version]

1- php -v
result for exapmle: PHP 7.4.28

2- sudo wget https://www.php.net/distributions/php-7.4.28.tar.gz.

3- sudo tar xfz php-7.4.28.tar.gz && sudo rm -rf php-7.4.28.tar.gz

4- cd php-7.4.28/ext/pcntl/

5- sudo phpize
if phpize is not installed you can install it with apt install php7.4-dev

6- sudo ./configure --with-php-config=/usr/bin/php-config

7- sudo make && sudo make install
the result must be like Installing shared extensions: /usr/lib/php/20190902/

8- cd ../../../ && sudo rm -rf php-7.4.28

9- cd /etc/php/7.4

10- sudo sh -c "echo 'extension=pcntl.so' > ./mods-available/pcntl.ini"

11- sudo nano ./cli/php.ini then add extension=pcntl.
repeat this job for sudo nano ./apache2/php.ini or sudo nano ./fpm/php.ini.

12- in all above php.ini there is disable_functions that include pcntl prefix. you must enable which one you want.

13- restart your apache2 or fpm with:
sudo service apache2 restart

14- you can check it with die(extension_loaded('pcntl')); in test.php

note: if you got error : PHP Warning: Module 'pcntl' already loaded in Unknown on line 0, remove extension=pcntl only in cli/php.ini

Source:https://stackoverflow.com/a/64634134/7521380

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay