Add pcntl extension to PHP in MAMP environment

Source: Internet
Author: User

PCNTL Introduction

The PCNTL extension can support multi-threaded operation of PHP. (This module is not supported for non-UNIX class systems)

Phpize Introduction

Phpize can be used to add extensions to PHP dynamically. For example, when compiling PHP, forget to add an extension, and later want to add the extension, that is, you can use phpize dynamic add the extension.

This article will show you how to use Phpize to add PHP pcntl extensions to the integrated environment MAMP your Mac. Unix-like environments can be installed using this method, and be flexible.

Installation:

The following demonstrates the addition of the pcntl extension to the PHP 5.6.10 version of Mamp.

Download and local PHP version corresponding to the source package, the address is:

http://www.php.net/releases/
Then follow the steps below to compile:

# 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 do this, 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

# Compiling pcntl.so files
$ CD Ext/pcntl
$ phpize
$./configure
$ make

# move the compiled extension file pcntl.so to the PHP extension 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 was 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.

Add pcntl extension to PHP in MAMP environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.