When working with php code, we often use xdebug to debug code, but on a beautiful day, suddenly after a series of system updates we can no longer use xdebug, which makes the work less efficient. when using var_dum () or echo to debug. After searching for a lot of time, it was discovered that version 3.0.1 has changed the port instead of using port 9000 now using port 9003. It seems to have been fixed, but without life, xdebug is still not working, so we need to reconfigure a little more.
First we change the php.ini file here, we use apache2 and php 7.2 so we will run the following command: sudo gedit /etc/php/7.2/fpm/php.ini
coppy the following config line into the php.ini file [xdebug]
1 2 3 4 5 6 7 8 9 10 11 | ;zend_extension=xdebug.so zend_extension = /usr/lib/php/20190902/xdebug.so xdebug.start_width_request = yes xdebug.idekey =VSCODE xdebug.mode =debug xdebug.discover_client_host = false xdebug.client_host=127.0.0.1 xdebug.client_port=9003 xdebug.remote_enable = 1 xdebug.remote_autostart=on |
Next, go to the xdebug.ini file to edit sudo gedit /etc/php/7.2/mods-available/xdebug.ini
add the following line to the file
1 2 3 4 5 6 | xdebug.remote_enable = 1 xdebug.remote_port = 9003 xdebug.idekey = VSCODE xdebug.show_error_trace = 1 xdebug.remote_autostart = 0 |
After editing the ini file, we fix the port in the json file
Finally restart apache2 to enjoy the results:
1 2 | sudo service apache2 restart |
Check activity https: // yoursite /? XDEBUG_SESSION_START = 1