Installing Pcntl for PHP on OSX Lion

Source: Internet
Author: User
Tags install homebrew
Today I needed to install the pcntl extension for PHP in a tutorial session at theDutch PHP Conference . And since I am working on OS X Lion, this is course gave some problems due to the rather odd installation of Apache and PHP On OSX.
Several sites on the web gave quick guides for this, but still, as always there is a few things you need to keep in M IND for it all to work. I'll try to walk through the process as detailed as possible:
First start by installing Xcode. You can get the latest version from the App Store. NOTE the App Store only has the latest version of Xcode, so if you need a version for Snow Leopard or older, you nee D to dig deep on the Web (Https://connect.apple.com Is a good place to start).
Next You need to install the Command line Tools from Xcode. Opening Xcode, go to Preferences (CMD +,)-Downloads, components and hits install on the Command Line Tools. You can get the Command line Tools without installing Xcode viaHttps://connect.apple.com
Now-you need-find out-what version of PHP was installed on OSX
$ php -v
PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb 20 2012 22:55:53) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
And then get the source code for that version
$ curl -O http://us.php.net/distributions/php-5.3.10.tar.gz
When the download has finished, you should unpack, find the pcntl extension, phpize, configure, make and then do in Stall
$ tar -xzvf php-5.3.10.tar.gf
$ cd php-5.3.10/ext/pcntl
$ phpize
$ ./configure
$ make
$ sudo make install
If Phpize is complaining, you are probably missing autoconf. The easiest -to-install autoconf is viaHomebrew . Install Homebrew by doing
$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
The first thing you need to do afterwards are to run
$ brew doctor
To find an If any dependencies is missing. Homebrew'll telle you and if any are missing.
Lastly need to enable the pcntl extension. Adding the following to your php.ini
extension=pcntl.so
If you does not know where your php.ini file is, you probably need to create on, by doing
sudo cp /private/etc/php.ini.default /private/etc/php.ini
Restart Apache and verify that the pcntl extension is loaded correctly
$ sudo apachectl restart
$ php -m | grep pcntl
pcntl
If The pcntl extension for some reason isn't loaded, try and copy the pcntl.so from the compiled source code to the E Xtensions Directory
$ sudo cp php-5.3.10/ext/pcntl/modules/pcntl.so /usr/lib/php/extensions/no-debug-non-zts-10090626/
Restart Apache and verify the the pcntl extension is loaded.
Resources:
    • Http://blog.lancerushing.com/2011/02/getting-phps-pcntl-working-on-snow.html
    • Http://stackoverflow.com/questions/8430977/phpize-wont-work-on-mac-os-x-lion
    • http://mxcl.github.com/homebrew/
    • Http://stackoverflow.com/questions/9343151/where-is-php-ini-in-mac-os-x-lion-thought-it-was-in-usr-local-php5-lib
    • Https://github.com/camertron/Pongo/blob/master/INSTALL_PCNTL

The above describes the installing Pcntl for PHP in the OSX Lion, including the content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    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.