How to enable pcntl in php (when using a framework like Symfony2)

c:\xampp\htdocs\login>php app/console server:start

An extension is required to execute this command pcntl.

This is the error I get when I try to start a web server in my environment symfony2.

I found a fix using the command:

$ php app/console server:run

But does anyone know why it server:startdoesn't work on my desktop? Thanks in advance.

My goal:

Web server launch

Running a Symfony application using the PHP embedded web server is as easy as running a command server:start:

$ php app/console server:start
+12
source share
4 answers

In windows

You cannot install the extension pcntlon Windows. According to the PHP documentation :

. Windows.

Vagrant Linux, Ubuntu, Debian Mint.


UNIX

:

mkdir php
cd php
apt-get source php5
cd php5-(WHATEVER_RELEASE)/ext/pcntl
phpize
./configure
make

:

cp modules/pcntl.so /usr/lib/php5/WHEVER_YOUR_SO_FILES_ARE/
echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini

!


Mac

Taken from fooobar.com/questions/198621/...!

PCNTL PHP, .

Mac OSX Snow Leopard (64 ), MAMP PHP 5.3.6. PHP , !

, make, Mac OSX. Mac, http://developer.apple.com/unix/

tar- PHP, , MAMP (, 5.3.6), http://www.php.net/releases/. Untar CD php- []/ext/pcntl, :

$ wget http://museum.php.net/php5/php-5.3.6.tar.gz
$ tar xvf php-5.3.6.tar.gz
$ cd php-5.3.6/ext/pcntl

phpize pcntl, , MAMP:

pcntl$ /Applications/MAMP/bin/php/php5.3.6/bin/phpize

, .

, 32- 64- , MAMP PHP . , .

pcntl$ MACOSX_DEPLOYMENT_TARGET=10.6
pcntl$ CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
pcntl$ CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
pcntl$ CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
pcntl$ LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
pcntl$ export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET

./configure make, :

pcntl$ ./configure
pcntl$ make

pcntl.so . MAMP PHP:

pcntl$ cp modules/pcntl.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/

, INI PHP, :

$ echo "extension=pcntl.so" >> /Applications/MAMP/bin/php/php5.3.6/conf/php.ini

PCNTL . , , :

$ /Applications/MAMP/bin/php/php5.3.6/bin/php --ri pcntl

pcntl

pcntl support => enabled

, !


Windows:

UNIX:

Mac:

:

+11

pcntl . php-cli, :

sudo apt-get install php-cli

doc

+2

pcntl Apache Ubuntu, Ubuntu 16, , Ubuntu 18, / PHP/Apache:

#! /bin/bash

php_ver=$(php -r 'print(join(".",array_slice(explode(".",phpversion()), 0, 2)));')
php_api_ver=$(php-config --phpapi)
pkg="php$php_ver"
mods_dir=/usr/lib/php/$php_api_ver/
php_conf_dir=/etc/php/$php_ver/apache2/conf.d
set -e
work_dir=/tmp/php-pcntl
rm -rf $work_dir
mkdir -p $work_dir
cd $work_dir
apt-get source $pkg
cd $pkg-$php_ver.*/ext/pcntl
phpize
./configure
make -j 8
sudo cp modules/pcntl.so $mods_dir
echo "extension=pcntl.so" | sudo tee $php_conf_dir/10-pcntl.ini > /dev/null
echo "pcntl extension installed, now restart Apache and make sure it really works"

, Apache/PHP: apt-get install php-dev php-cli, /etc/apt/sources.list , deb-src , apt-get update. , . , rm -rf /tmp/php-pcntl - , - , .

, , php.ini disable_functions=. . Ubuntu 16 pcntl_signal() php.ini.

0

php-extension-library github contains several pcntl.so files that you can easily download for your version of PHP and add .ini to your extensions.

For example, for php version 7.3.9:

  1. Download pcntl.so from the repository here or right here .
  2. Move the file pcntl.soto the extension (for example: /Applications/MAMP/bin/php/php7.3.9/lib/php/extensions/no-debug-non-zts-xxxxxxxx)
  3. Add extension=pcntl.soto your.ini
0
source

Source: https://habr.com/ru/post/1610928/


All Articles