PHP Internals Book


«  Internal structures and implementation   ::   Contents   ::   Using the PHP build system  »


This book is a collaborative effort between several PHP developers to better document and describe how PHP works internally.

There are three primary goals of this book:

  • Document and describe how PHP internals work.
  • Document and describe how to extend the language with extensions.
  • Document and describe how you can interact with the community to develop PHP itself.

This book is primarily targeted at developers who have experience in the C programming language. However, where-ever possible we will attempt to distill the information and summarize it so that developers who don’t know C well, will still be able to understand the content.

However, let us insist. You won’t be able to achieve something productive, stable (crash free under any platform), performant and useful, if you don’t know the C language. Here are some pretty nice online resources about the C language itself, its ecosystem and build tools, and Operating System APIs :

We also highly recommand you some books. You’ll learn with them how to efficiently use the C language, and how to make it translate to efficient CPU instructions so that you can design strong/fast/reliable and secure programs.


This book is Work-In-Progress and some chapters have not been written yet (in particular the ones on creating basic extensions and declaring functions), so if you’re completely new to PHP extension development you’ll have to wait until the remaining introductory chapters are published or start off with other resources on the topic.

The repository for this book is available on GitHub. Please report issues and provide feedback on the issue tracker.

«  Internal structures and implementation   ::   Contents   ::   Using the PHP build system  »