Wednesday, June 6, 2012

Installing PCNTL for PHP on OSX Lion

Today I needed to install the PCNTL extension for PHP for a tutorial session at the Dutch PHP Conference. And since I am working on OSX Lion, this of 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 are a few things you need to keep in mind for it all to work. I will 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 that the App Store only have the latest version of Xcode, so if you need a version for Snow Leopard or older, you need 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. You do this by opening Xcode, go to Preferences (CMD + ,) -> Downloads -> Components and hit install on the Command Line Tools. You can get the Command Line Tools without installing Xcode via https://connect.apple.com

PHP_FE_END is supposed to be defined as the value {NULL,NULL,NULL} in the main php headers, but for some reason, the copy of these headers installed for some versions of PHP are sometimes missing these macros, though it exists in the headers in the source distribution.

The fix was to edit pcntl.c and on line 175 replace PHP_FE_END with {NULL,NULL,NULL}

I am starting to learn php but now i am doing some apps y in c++ so i don't have enough time to learn both i hope in the future i can learn and share my knowledge to maybe you can teach me some of you tricks if you get a whatsapp download