I am debugging php. When searching in a devote memory where I understand a pointer for an address is, I begin to see the pointer - for instance 22810408 (0x08048122) - this is where while using CLI version of php.
HOWEVER, when I am using apache2 and trying to complete exactly the same factor, I do not visit a pointer towards the real address. Rather, an offset in the ELF header that after put into the address from the ELF header, provides me with the "real" address. For instance, when the "real" address was 0x08048122, and also the ELF header was at 0x08048000 i quickly would see 22010000 (0x122) only at that same position.
The issue arises after i try to determine the "real" address of something that's around the stack. The "real" address should be 0xbfccxxxx, however when adding the amount I've found towards the ELF header, things just don't accumulate! I recieve all of the wrong addresses.
I have already attempted searching for any very long time, however i am not really sure how you can word this properly, or what to find.
So, what I am basically searching for is a lot of WHY Apache comes with an offset rather than a genuine memory address, and just how all of this pertains to addresses around the stack. Could anybody produce any pointers to material that may clarify?
mod_php on its' side loads and utilizes the zend API to parse and return PHP files to apache. As you can tell there's lots of indirection here. This process works more effectively and faster than letting apache use PHP like a daemon or similar.
When debugging PHP you normally focus on a significantly greater level than this, because even when you receive the offsets right PHP datatypes aren't 1:1 individuals of C (due to PHP's duck typing) as well as for associative arrays and objects the representation in memory is extremely different compared to a C object.
I would suggest you to employ a specialized PHP debugger to debug PHP programs.