How to enable PCNTL in Apache
Hello, in this guide I will teach you how to enable PCNTL in Apache, so you can make things like this.
Note: this module only works on unix system
Let’s Go
- First of all we have to create a folder where we are going to store temporary files. In my case I will call it PHPTemp
- Download the following file https://www.php.net/distributions/php-7.0.33.tar.gz
- Uncompress that file in the previously created folder
- Run sudo apt install php7.0-dev to install php-dev so we can use phpize to compile PHP extensions
- Go to /ext/pcntl folder
- Now run the following command inside /ext/pcntl folder sudo phpize
- Excecute the following command’s
- sudo ./configure — with-php-config=/usr/bin/php-config
- sudo make && sudo make install
- If everything works fine the previous command should print something like “Installing shared extensions: /usr/lib/php/20151012/”
- Now that we have the bin files of the module, the next thing we should do is to enable this so we can use it in Apache. In order to do this we should excecute the following command:
echo "extension=pcntl.so" > /etc/php/7.0/mods-available/pcntl.ini
- And that’s all. We’ll need to restart Apache and the module should be available
Note: This guide can change depending on the Linux distribution and PHP Version.