Skip to content

Instantly share code, notes, and snippets.

@shauvik
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save shauvik/6c0c7e69edc3e579b791 to your computer and use it in GitHub Desktop.

Select an option

Save shauvik/6c0c7e69edc3e579b791 to your computer and use it in GitHub Desktop.
; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
auto_prepend_file = /Users/shauvik/Library/Containers/com.bitnami.mampstack/Data/app-5_4_9/apache2/htdocs/php_trace/prepend.php
; Automatically add files after PHP document.
; http://php.net/auto-append-file
auto_append_file = /Users/shauvik/Library/Containers/com.bitnami.mampstack/Data/app-5_4_9/apache2/htdocs/php_trace/append.php
;...
;[XDebug]
;; Only Zend OR (!) XDebug
zend_extension="/Applications/MampStack.app/Contents/Resources/app/php/lib/php/extensions/xdebug.so"
;xdebug.remote_enable=true
;xdebug.remote_host=127.0.0.1
;xdebug.remote_port=9000
;xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=/tmp
;Shauvik
xdebug.collect_assignments=1
xdebug.collect_params=4
xdebug.collect_return=1
xdebug.trace_format=1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=-1
<?php
//var_dump(xdebug_get_code_coverage());
//xdebug_stop_code_coverage();
$headers = getallheaders();
if(array_key_exists('Trace-Request-Id', $headers)) {
xdebug_stop_trace();
}
<?php
//xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$base = "/Users/shauvik/Library/Containers/com.bitnami.mampstack/Data/app-5_4_9/apache2/htdocs/xtlogs/";
$patharr = explode("/",$_SERVER['REQUEST_URI']);
$foldername = count($patharr)>1 ? $patharr[1] : '';
if($foldername){
if (!file_exists($base.$foldername)) {
mkdir($base.$foldername);
}
$base = $base.$foldername.'/';
}
$headers = getallheaders();
//echo $headers['RequestId'];
//var_dump($headers);
if(array_key_exists('Trace-Request-Id', $headers)) {
xdebug_start_trace($base.'trace.'.$headers['Trace-Request-Id']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment