Objective:
PCNTL Introduction
PCNTL extensions can support multithreaded operations in PHP. (Non-UNIX class systems do not support this module)
Phpize Introduction
Phpize can be used to dynamically add extensions to PHP. For example, when compiling PHP, forget to add an extension, and then want to add the extension, that is, you can use phpize dynamic to add the extension.
This article describes how to add pcntl extensions for PHP using phpize to the integrated environment under Mac Mamp. Unix-like environments can be installed using this method, with a note of flexibility.
Installation:
The following is a demonstration of adding pcntl extensions to the PHP 5.6.10 version of Mamp.
Download and the local PHP version corresponding to the source code package, the address is:
http://www.php.net/releases/
Then compile the following steps:
# Unzip the source package and initialize the directory
$ TAR-XZVF php-5.6.10.tar.gz
$ mv php-5.6.10 PHP
$ mkdir-p/applications/mamp/bin/php/php5.6.10/include
$ MV Php/applications/mamp/bin/php/php5.6.10/include
# Detection System Configuration
$ cd/applications/mamp/bin/php/php5.6.10/include/php
$./configure
# Add some flags to tell the system how to compile. Mamp PHP has been built so that if you do not, the compiled shared object will not work.
$ macosx_deployment_target=10.10
$ cflags= "-arch i386-arch x86_64-g-os-pipe-no-cpp-precomp"
$ ccflags= "-arch i386-arch x86_64-g-os-pipe"
$ cxxflags= "-arch i386-arch x86_64-g-os-pipe"
$ ldflags= "-arch i386-arch x86_64-bind_at_load"
$ export cflags cxxflags ldflags ccflags macosx_deployment_target
# Compile Pcntl.so file
$ CD Ext/pcntl
$ phpize
$./configure
$ make
# move the compiled extension file pcntl.so to PHP's extended directory
$ CP modules/pcntl.so/applications/mamp/bin/php/php5.6.10/lib/php/extensions/no-debug-non-zts-20131226/
# Add the extension to the php.ini file
$ echo "extension=pcntl.so" >>/applications/mamp/bin/php/php5.6.10/conf/php.ini
# PCNTL should now be enabled, to check if the installation is successful, just run:
$/applications/mamp/bin/php/php5.6.10/bin/php--ri Pcntl
Pcntl
PCNTL Support => Enabled
If the above information appears, the extension has been installed successfully.