After some consideration, I determined that the best starting point would be the code for the navigation breadcrumbs. The ability to step into the code is a much better way to debug then the old method of vardump and print at various points to see where your flow goes wrong. I've done some minor customizations for it in the past, but didn't have any idea how to determine the position of the current page in the sitemap. The CMS is running on an older version of CMSimple_XH. I was asked to modify its template to show a different logo based on where in the sitemap the current page is located. The latest reason for this was a CMS site for a local community organization I'm administering. Here is example script ( all_probes.stp) for tracing all core PHP static probe points throughout the duration of a running PHP script with SystemTap: probe process("sapi/cli/php").provider("php").I haven't done much PHP development, but occasionally I still need to read or write some PHP code. Note: Dtrace is available on OS X by default, on Linux you probably need dtrace4linux or check for some other alternatives.Īlternatively check for SystemTap tracing by installing SystemTap SDT development package (e.g. From there access some pages to see the trace output. To test that, you can go to any docroot with index.php and run PHP builtin server by: php -S localhost:8080Īfter that you can access the site at (or choose whatever port is convenient for you). On another terminal run: php -r "phpinfo() ".Printf("%Y, PHP request-startup:\t%s at %s via %s\n", walltimestamp, basename(copyinstr(arg0)), copyinstr(arg1), copyinstr(arg2)) Printf("%Y: PHP request-shutdown:\t%s at %s via %s\n", walltimestamp, basename(copyinstr(arg0)), copyinstr(arg1), copyinstr(arg2)) Printf("%Y: PHP function-return:\t%s%s%s() in %s:%d\n", walltimestamp, copyinstr(arg3), copyinstr(arg4), copyinstr(arg0), basename(copyinstr(arg1)), (int)arg2) Printf("%Y: PHP function-entry:\t%s%s%s() in %s:%d\n", walltimestamp, copyinstr(arg3), copyinstr(arg4), copyinstr(arg0), basename(copyinstr(arg1)), (int)arg2) ![]() Printf("%Y: PHP execute-return:\t%s:%d\n", walltimestamp, basename(copyinstr(arg0)), (int)arg1) Printf("%Y: PHP execute-entry:\t%s:%d\n", walltimestamp, basename(copyinstr(arg0)), (int)arg1) Printf("%Y: PHP exception-thrown:\t%s\n", walltimestamp, copyinstr(arg0)) Printf("%Y: PHP exception-caught:\t%s\n", walltimestamp, copyinstr(arg0)) Printf("%Y: PHP error message:\t%s in %s:%d\n", walltimestamp, copyinstr(arg0), basename(copyinstr(arg1)), (int)arg2) Printf("%Y: PHP compile-file-return:\t%s (%s)\n", walltimestamp, basename(copyinstr(arg0)), basename(copyinstr(arg1))) Printf("%Y: PHP compile-file-entry:\t%s (%s)\n", walltimestamp, basename(copyinstr(arg0)), copyinstr(arg1)) Here is more advanced dtrace script, just save it into dtruss-php.d, make it executable ( chmod x dtruss-php.d) and run: #!/usr/sbin/dtrace -Zs You may trace your script with easy to remember alias: trace-php. Register_shutdown_function('shutdown_handler') įunction assert_callcack($file, $line, $message) "' Ability to display and change the values of variables and properties. Ability to step through and over procedures. ![]() Set_exception_handler('exception_handler') According to Microsoft, the Script Debugger provides these traditional debugging features: 2 Ability to set and clear breakpoints. This is my little debug environment: error_reporting(-1) Īssert_options(ASSERT_CALLBACK, 'assert_callcack')
0 Comments
Leave a Reply. |