Link to home
Start Free TrialLog in
Avatar of Kobz46
Kobz46

asked on

How to trace Object-Oriented function calls in PHP without adding code to each function

I developed an code-base (single file) where all my functions are housed. Whenever I need to call one of these functions, I "require" this file.
I rescently discovered that this is a very stupid way of doing it as the file gets parsed and compiled every time I require it, causing a huge execution time bottleneck.

Now I want to split this file into smaller files, only containing the relevant functions for each page call, and only require this small file, instead of the whole "code-base" each time.

Is there an easy way of logging/tracing which functions are called upon file execution so that I can determine which functions to include in these smaller files? I've tried using xdebug, but this logs only PHP native functions, and need extra code added per function to enable me to trace calls to my custom functions. (Correct?)
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kobz46
Kobz46

ASKER

Looks promising. I'll install and re-run my stress test to see if this helps. Thanks.
Avatar of Kobz46

ASKER

Could you please assist with this error?

I've installed re2c, gawk and the apache2-threaded-dev packages.


APC-installation.gif
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kobz46

ASKER

OK, reinstalled apache-threaded-dev and APC installed perfectly. Gonna run some test and will report back and assign points as needed.
Avatar of Kobz46

ASKER

Problem. When I restart apache the page loads on the first load, upon reload, the page comes back blank. Is there anything I need to configure? When commenting out the extension in php.ini all runs fine, so the problem must be somewhere within APC.
Are you running APC with xdebug then try to disable xdebug and test APC again.
Avatar of Kobz46

ASKER

Apache gives me the following in the error.log

child pid xxx exit signal segmentation fault(11)
child pid xxx exit signal segmentation fault(11)
child pid xxx exit signal segmentation fault(11)
child pid xxx exit signal segmentation fault(11)
Avatar of Kobz46

ASKER

xdebug in commented out in php.ini
hm strange it works here very well since years, but depending on your code APC might have bugs. which causes the opcache to fail. Does this only happen with your pages or with any page (also a phpinfo() page?)
Avatar of Kobz46

ASKER

All pages. Same happens on phpinfo(). Loads once after restarting apache, and then on next reload comes back blank. No source whatsoever. On every load retry, It's logs the segmentation fault in apache error log.

Apache 2.2.8 (Ubuntu)
Avatar of Kobz46

ASKER

strange thing is that it loads every page once, and then fails after reloading that same page.
the 1st time it parses and conmpiles the php-file into opcode 2nd time the opcode is taken from the cache and there the opcodes semm to be invalid/broken. Any other zend_extension install. Can you post the phpinfo() output without the apc loaded to see wich other modules are installed which might cause problems?
Avatar of Kobz46

ASKER

OK....got it solved. Seems like it clashed with ZendOptimizer. Uncommented and all is running well. No proceeding with stress test! Phew!!
Avatar of Kobz46

ASKER

Just did a bencmark and I can now do 300+ average mySQL queries instead of 34. AMAZING!!