Quantcast
Channel: PHPDeveloper.org
Viewing all articles
Browse latest Browse all 10

Abhinav Singh's Blog: PHP Extensions - How and Why?

$
0
0

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.


Viewing all articles
Browse latest Browse all 10

Trending Articles