However you can visit their archive and download the version of xdebug that corresponds to your version of PHP. Xdebug recommends that you have PHP version 7.X which is needed to work with latest version of their debugger. Solutionįor this tutorial we are using version 7.2 of PHP on our remote server. My development computer runs on Windows 10 and I use Visual Studio Code as my IDE. hence I had no way of connecting directly to server without first connecting to the VPN. The remote server was running Linux within a VPN. It contains a single step debugger to use with IDEs it upgrades PHP’s var_dump() function it adds stack traces for Notices, Warnings, Errors and Exceptions it features functionality for recording every function call and variable assignment to disk it contains a profiler and it provides code coverage functionality for use with PHPUnit - Xdebug Xdebug is an extension for PHP to assist with debugging and development. In order to debug my PHP code I used xdebug. In this tutorial, I will show you how to overcame that challenge. One challenge that I have faced is finding a way to debug that remote code in my local development environment with apache and PHP running on a remote server. In the past I have faced challenges when debugging code that resides on a remote server, that in order to connect, requires a connection to a virtual private network (VPN). Bugs are never pleasant but we can learn so much from them and they certainly help to shape the type of developer we become. ![]() When these errors arise you will need to have some sort of strategic approach to resolving your bugs. Now, verify whether Xdebug is installed by checking the PHP info output as shown in Fig 5.Updating to a new version of any Content Management System (CMS) can lead to many errors in your website, especially when using custom plugins, modules or components. Sudo nano /etc/php/8.0/apache2/conf.d/99-xdebug.ini # Install the pre-requisites to compile PHP extensionsĪpt-get install php-dev autoconf automakeĬonfig.m4:12: warning: file `build/pkg.m4' included several timesĬp modules/xdebug.so /usr/lib/php/20200930 We can follow the steps mentioned by the Xdebug analyzer to install Xdebug for PHP 8 on Ubuntu 20.04 LTS as shown in Fig 4. We can either run it on Console or access it via browser. Write a simple program to print the output of phpinfo() function as shown below. In this section, we will test whether Xdebug for PHP is installed and the steps required to install and configure the most recent version of Xdebug for PHP on Ubuntu 20.04 LTS. Stop - Terminate the current execution of the program and clear the variables stack and breakpoints from memory. The instruction pointer will point to the statement where the execution pause. The program execution will pause at the next breakpoint if there is any. Resume - Resume the execution as the program executes normally till the next breakpoint encounters. It skips the function and executes it without entering into it. Step Over - Execute the current statement without going into the function if it's there. Step Out or Step Return - Execute the remaining statements of the function completely and move out of the function and set the instruction pointer on the statement next to the function call. The execution will pause at the first statement of the function. We can step into the function called on the current statement to further check it. Step Into - Move to the next statement in case there is no function call or enter the function to debug it in case there is a function call on the current statement. The breakpoints are added intentionally to check the program for possible errors. These are listed below.Ĭurrent Instruction Pointer - The instruction pointer pointing to the current statement where the debugger is paused and waiting for the next instructions.īreakpoint - The program execution pauses at the breakpoint until further instructions are not provided by the debugger. ![]() ![]() This section explains all the major terms specific to debugging. You can also follow How To Install PHP 7 On Ubuntu 20.04, How To Install PHP 8 On Ubuntu 20.04 LTS, How To Install Apache 2 On Ubuntu 20.04 LTS, How To Install And Configure Nginx on Ubuntu 20.04 LTS, How To Install PHP For Nginx On Ubuntu 20.04 LTS, and How To Install VSCode For PHP On Ubuntu. It assumes that PHP and Web Server are already installed on the Ubuntu system. In this tutorial, we will discuss the terms specific to debugging and the steps required to debug PHP programs using Xdebug 3 and Visual Studio Code or VS Code for PHP applications on Ubuntu 20.04 LTS.
0 Comments
Leave a Reply. |