From the start, one of the design goals of phc has been to provide a useful framework for writing applications that process PHP scripts. phc parses PHP code into an internal representation known as an abstract syntax tree or AST. Applications can process PHP code by analysing and modifying this abstract representation in one of two ways:
The Tree Traversal API Tutorials explain how to write plugins for phc, and provide numerous examples. You will find Reference very useful when writing serious applications using phc.
Although we have tried to document phc as well as we can, if anything is still unclear, please let us know by sending an email to the mailing list.
If you want to modify the internals of phc in other ways than through the explicit API we provide for doing so, you will following tools listed below, in addition to those detailed in the user manual (Installation Instructions). However, most people should not need these tools (even if you are implementing tools based on phc).
When compiling PHP for use with phc, there are a few options:
Development: For developing phc or debugging phc problems, it is worthwhile to have debugging symbols and leak checkers enabled.
CFLAGS="-O0 -ggdb3" ./configure --enable-debug --enable-maintainer-zts --enable-embed
Deployment: For performance, optimization should be used:
CFLAGS="-O3 -g" ./configure --enable-embed
Benchmarking: In order to be fair, both phc-generated-code and PHP should both be compiled with -O3. The are also some options required to run some benchmarks. The prefix is supplied to correspond to benchmarking scripts we provide:
CFLAGS="-O3 -DNDEBUG" ./configure --enable-embed --enable-bcmath --with-gmp --prefix=/usr/local/php-opt