Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell:
Compiling PHP Extensions
Aug 29, 2014 @ 14:28:42

Lorna Mitchell has posted a quick guide to compiling PECL extensions to her site today. This is for those users on unix-based systems that might need to manually compile with some custom options (or may be working on your own extension and may just need to test it).

There are lots of reasons why you might like to compile your own PHP extensions. [...] I haven't seen a really approachable guide anywhere, we tend to speak of extensions in hushed tones, and actually it isn't particularly tricky so here is my quick how-to guide.

The process is relatively simple for those familiar with the command line and the steps involved in compiling software. There's some special PHP-only steps you'll have to take before compiling the code to make sure it's ready to be a PHP extension. Then it's up to the usual configure+make_make install to ensure the .so file is correctly generated.

tagged: compile extension tutorial phpize module

Link: http://www.lornajane.net/posts/2014/compiling-php-extensions

PHP-Security.net:
Suhosin 0.9.34-DEV Installation HowTo
May 03, 2012 @ 16:54:57

On the PHP-Security.net blog today there's a new post showing how to get the latest version of the Suhosin security patch for PHP installed.

With the recently released PHP 5.4, the Suhosin patch and extension were removed from many Linux distribution packages (i.e., Debian et al.) and until three weeks ago, there was no possibility to compile and run the Suhosin extension under PHP 5.4. This little howto shall serve as installation instruction for Debian Wheezy users - your mileage may vary. I blogged about this here.

They start with the apt-get commands to install the latest PHP5 for your distribution (yum commands are similar, of course) and includes the location to download the latest Suhosin version from Stefan Esser's github account. Unpack it, compile and "phpize" it and if all goes well, you should have a shared module built and ready for use.

tagged: install suhosin shared module compile phpize tutorial

Link:

Christian Weiske's Blog:
Installing PHP extensions for phpfarm
Jul 25, 2011 @ 13:15:15

Christian Weiske has a new post to his blog today on how to get PHP extensions installed for phpfarm, the tool that lets you switch between multiple PHP versions on the same machine.

When using several PHP installations with phpfarm, installing PHP extensions is not always easy - mostly because Pyrus is very strict about package files - and many of the packages in PECL unfortunately have invalid non-validating package.xmls.

The installation follows most of the normal process with one exception - you use the phpfarm phpize and point the configure to use the phpfarm ini configuration file then enable it as usual.

tagged: extension phpfarm multiple pear pyrus phpize configure

Link:

Zend Developer Zone:
Compiling PHP extensions with Zend Server
Apr 30, 2009 @ 13:46:52

On the Zend Developer Zone a new tutorial has been posted showing how to compile PHP extensions to work with the Zend Server web platform.

To date, Zend Server includes 77 PHP extensions that Zend considers essential or just very helpful for most PHP developers. Still, what if the one that your code uses is not among them? Or you wish to compile one of the extensions Zend Server is shipped with in a different way (against your own libraries or to support additional, less common features)? If this scenario sounds familiar to you, you may find this tutorial useful.

You'll need to know a bit about compiling and some of the tools (like autoconf, automake, the gcc compiler, and libtool) before you get started. Two scenarios are described - one for installing and compiling the Newt extension (RedHat's Newt New Terminal library) and another slightly less automated for the Pspell extension.

Each of these examples make a shared module that can be included into the PHP installation via your php.ini.

tagged: zendserver extension compile phpize shared module phpini

Link:

Zend Developer Zone:
Wrapping C++ Classes in a PHP Extension
Apr 23, 2009 @ 15:21:50

On the Zend Developer Zone a new tutorial has been posted looking at taking your pre-existing C++ functionality and wrapping it in a PHP extension to be used directly in your code.

In this tutorial I am going to walk you through creating a PHP extension called "vehicles" which will expose a single class called "Car" (obviously in the real-world, your extensions will expose many classes, but I’m trying to keep things simple). The extension will be built for PHP 5. I am only going to give instructions for building the extension in a UNIX-like environment, although most of what I cover should apply to Windows extension development as well.

The tutorial walks you through everything - how the file layout should look, making a build system, the contents of his files (the sample extension lets you do things to the Car like shift gears and brake) and how to combine the C++ code with the build process to create a shared module you can include right in your php.ini.

tagged: module shared phpize buildfile tutorial c extension cplusplus class

Link:

Abhinav Singh's Blog:
PHP Extensions - How and Why?
Dec 12, 2008 @ 17:17:23

Abhinav Singh has posted a guide to PHP extensions - what they are and how to write a simple "hello world" one.

Assuming you have read the previous post, lets discuss on how to build our first PHP extension: every PHP extension is built out of minimum of 2 files, a configuration file (config.m4) which tells us what files to build and what external libraries are needed and source File(s) which will contain the actual functionality.

He builds up an example skeleton for an extension (the config.m4) and explains how the file will be phpized and configured. Next up is the php_sample.h header file where the needed modules are loaded and the sample.c file to define them. Last, but not least, comes the extension code itself that calls the printf function to output the "hello world" message.

tagged: extension tutorial header file config phpize helloworld

Link:

John Coggeshall's Blog:
Compiling extensions for Zend Core
Jan 08, 2008 @ 15:32:00

John Coggeshall has blogged about a method he's worked up for compiling extensions into the Zend Core software.

While Core does ship with a large list of extensions (which are all QA'd and supported by Zend) there are times when you would like to include non-official extensions from PECL for various reasons.

He breaks it down into a few simple steps - download, "phpize" the extension, compile it and add the extension to the php.ini. He details the second step of the process (the phpize) because of some of the differences there are between doing it for a normal PHP install and a Zend Core install.

He also provides directions for an exception to the rule - compiling a PDO driver for your ZC install. You'll have to trick the Zend Core installation into using the right files, though. Full instructions are included.

tagged: compile extension zendcore pdo sqlite phpize compile extension zendcore pdo sqlite phpize

Link:

John Coggeshall's Blog:
Compiling extensions for Zend Core
Jan 08, 2008 @ 15:32:00

John Coggeshall has blogged about a method he's worked up for compiling extensions into the Zend Core software.

While Core does ship with a large list of extensions (which are all QA'd and supported by Zend) there are times when you would like to include non-official extensions from PECL for various reasons.

He breaks it down into a few simple steps - download, "phpize" the extension, compile it and add the extension to the php.ini. He details the second step of the process (the phpize) because of some of the differences there are between doing it for a normal PHP install and a Zend Core install.

He also provides directions for an exception to the rule - compiling a PDO driver for your ZC install. You'll have to trick the Zend Core installation into using the right files, though. Full instructions are included.

tagged: compile extension zendcore pdo sqlite phpize compile extension zendcore pdo sqlite phpize

Link:


Trending Topics: