views:

264

answers:

1

I am trying to understand how the php compiler/interpretor works.

I tried to download the php source code and tried to understand how it works. I was not able to find proper documentation. WOuld be great if someone could throw light on th modules that make the php compiler and also how the apache server uses the php compiler..

Thanks

+1  A: 

As webbiedave said you might want to study the basics of compilers/interpreters. You can find most of the parser and lexer stuff in the files Zend/zend_language_scanner.l and Zend/zend_language_parser.y

If you want to get a feeling of how php works I suggest you set breakpoints at the beginning of zend_execute_scripts() in Zend\zend.c and at the line

if ((ret = EX(opline)->handler(execute_data TSRMLS_CC)) > 0)

in the file Zend\zend_vm_execute.h and then step through the code.

VolkerK