quick setup instructions for profiling php scripts on a mac with xdebug + webgrind

Posted: November 25th, 2008 | Author: sofia | Filed under: useful | Tags: , , , , | No Comments »

These instructions are for xampp on a mac.

  1. Download xdebug.so from activestate (thank you Komodo)
  2. Copy xdebug.so (choose the correct xdebug according to your php version) to xampp/xamppfiles/lib/php/php5/extensions/no-debug-non-zts-########/xdebug.so .
  3. Configure php.ini:
    At the end of php.ini (it’s in xampp/etc/php.ini) add

    zend_extension=/Applications/xampp/xamppfiles/lib/php/php5/extensions/no-debug-non-zts-20060613/xdebug.so
    xdebug.remote_enable = 1
    xdebug.remote_port = 9000
    xdebug.remote_host = localhost
    xdebug.show_local_vars=1
    xdebug.dump.SERVER=HTTP_HOST, SERVER_NAME
    xdebug.dump_globals=On
    xdebug.collect_params=4
    xdebug.profiler_enable=On
    xdebug.profiler_enable_trigger=On
    xdebug.profiler_output_name=”%p-%R”

    The “xdebug.profiler_output_name=”%p-%R”" sets the file name to process pid (default) + “-” + the REQUEST URI (helpful if you’re rewriting urls). The xdebug.dump commands are not for profiling but they improve var_dump & error messages. Check zend’s article series on xdebug for more info.

  4. Run php info & check xdebug’s there.
    If you get ‘could not load.. (null)’ you probably downloaded the wrong version for your mac. Also check the path to xdebug is correct (the no-debug-non-zts-####### part might be different)
  5. Install webgrind: download from here and copy directory to xampp/xamppfiles/htdocs folder
  6. Visit your script with ?XDEBUG_PROFILE=1 appended to the end of the url. Eg http://localhost/myapp/index.php?XDEBUG_PROFILE=1
  7. Now navigate to webgrind (eg. http://localhost/webgrind/ ), select the correct file from the dropdown - you can see the files xdebug’s created in yout /tmp directory -  and you should see the profiling info.
  8. Done!

Sources:

Might be interesting:

http://www.maccallgrind.com/


quick tip: installing the missing quartz-wm for Cross Over Chrome

Posted: September 17th, 2008 | Author: sofia | Filed under: useful | Tags: , , | No Comments »

Those that decided to try out the chrome cross over port on their macs probably noticed that when chrome is first run, it strongly encourages the installation of quartz-wm included in Apple X11, in turn included in the cd. First i tried to reinstall X11 but it said i had a newer version so tried this tip that proved helpful 10.4: Provide Crossover with a missing quartz-wm and curiosity satisfied (hmm.. probably killed the cat and a bit of my time as well), i now have a working chrome in my mac.