Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
basic-debugging [2021/06/10 15:19]
andre
— (current)
Line 1: Line 1:
-====== Debugging ====== 
  
-A topic that is probably not covered enough. If you do not have debugging working in your IDE environment then you are sadly wasting a lot of your own time.  A debugger allows you to step through problem code and figure out what is going wrong without adding all those die(), var_dump() and print_r() statements. 
- 
-Tina4 helps a little with the initial debugging by showing decent error messages and identifying the code where your errors occurred but the most important thing is to install x-debug for PHP and get yourself up and running. 
- 
-Installing a debugger can be a bit painful at first however once you have one working the rewards are self evident. 
- 
-Get started by installing x-debug, here are some pointers below for the various operating systems: 
- 
-**Windows** - should be able to download and enable the extension\\  
-**Linux & Mac** - try a [[https://pecl.php.net/|PECL]] install first otherwise you are going to be compiling from source code 
- 
-Here is a link to get you started: 
- 
-[[https://xdebug.org/docs/install|Installing Xdebug]] 
- 
-===== PHP.ini ===== 
- 
- 
- 
-Please be aware that the latest versions of x-debug have changed somewhat and the configurations that used to work are no longer valid.  Below is a configuration that works. 
- 
-   [Xdebug]  
-   zend_extension=xdebug 
-   xdebug.mode = debug 
-   xdebug.start_with_request=yes 
-   
-   
- 
-==== Running Tina4 in debug mode ==== 
- 
-If you are using PHPStorm or IntelliJ which are available from [[https://www.jetbrains.com/?from=Tina4| here]] then the following will get you started with little configuration. 
- 
-   XDEBUG_CONFIG="client_host=127.0.0.1" composer start 8080 
- 
-In your IDE look for the icon that looks like a telephone with a bug below it 
-    
-{{:debug.telephone.png?200|}} 
- 
-Clicking it on will allow the IDE to start listening for a debugging request based on the command you ran before. Below is how it looks when the IDE is listening for a debugging connection. 
- 
-{{:debug.listening.png?200|}} 
- 
-Once you hit up your web page on [[http://localhost:8080]], the debugger should activate and you need to accept the connection. 
- 
-{{:debug.enable.png?400|}} 
- 
-Add break points in your code by clicking on the left margin where you want the debugger to stop and you should get something like this 
- 
-{{:debug.running.png?400|}} 
- 
- 
-<WRAP center round tip> 
-    * Don't forget to turn off your debugger telephone when you're done 
-    * Learn shortcut keys like F8 - step and F7 - step into as well as F9 to run through debugging quickly 
-</WRAP> 
- 
-  

Powered by ComboStrap