I have a PHP website on a Apache server, and I would like to know if there are tools and other ways I can profile this to find bottlenecks on the code. What I need to know is what functions are taking long to process, etc.
Something like gprof, except for PHP on live apache server.
What are other ways to find bottlenecks in a PHP system.
If you are running on OpenSolaris, consider dtrace. The biggest advantage probably is that you can also probe into other layers like Apache, Mysql. dtrace has low overhead and you can selectively enable only the probes that you want to monitor.
You can use xdebug - once installed you can trigger profiling of requests in a variety of ways, and you wind up with a valgrind format profile for each request. Load this in WinCacheGrind, KCacheGrind or similar and drill down to find where all the time is spent!
Let me also mention Pinba
In my opinion, it is more suitable for the multiple servers setup rather than for just one server, but in case your project grow..
dtrace in fact has almost zero overhead unless you enable thousands of probes think it is also available on the BSD's
XHProf was designed for this use case.
XHProf (open sourced by Facebook in 2009) powers Facebook's XHProfLive -- a real-time performance monitoring system that provides function level insights from production tiers.
A snippet from XHProf doc:
regards, Kannan Muthukkaruppan
You can use phpdebug for this job. It's a php extension.