Debugging: Difference between revisions
remove old info |
No edit summary |
||
Line 6: | Line 6: | ||
A more current setup would be [[debugging Semantic MediaWiki in a Docker container using VSCode with PHPDebug]]. | A more current setup would be [[debugging Semantic MediaWiki in a Docker container using VSCode with PHPDebug]]. | ||
== Install == | |||
Ensure that XDebug extension is installed for your PHP environment. | |||
in the console, you can <code>php -r 'phpinfo();' | grep -i xdebug</code> | |||
Or, better yet, create a file like '''info.php''' <syntaxhighlight lang="bash"> | |||
# choose a target | |||
myFile = '../../info.php'; | |||
# add the phpinfo() function | |||
echo -e "<?php \nphpinfo();\n" > $myFile; | |||
# add the xdeub_info() function | |||
echo -e "\n\nxdebug_info();\n" >> $myFile; | |||
</syntaxhighlight> |
Revision as of 17:00, 11 February 2025
Debugging a PHP application can involve quite a bit of machinery, and effort getting that machinery setup. But it's worth it because what alternative is there? echo
? Come on!
Thanks to Derick Rethans, XDebug can do a ton of cool things for you. For example, it overloads var_dump()
and gives you control over how you want deeply nested data structures to be displayed.
We did an old deep dive using NetBeans and XDebug on a complex CiviCRM mailer embedded as a module in Drupal
A more current setup would be debugging Semantic MediaWiki in a Docker container using VSCode with PHPDebug.
Install[edit]
Ensure that XDebug extension is installed for your PHP environment.
in the console, you can php -r 'phpinfo();' | grep -i xdebug
Or, better yet, create a file like info.php
# choose a target
myFile = '../../info.php';
# add the phpinfo() function
echo -e "<?php \nphpinfo();\n" > $myFile;
# add the xdeub_info() function
echo -e "\n\nxdebug_info();\n" >> $myFile;