Tag Archives: Windows Tutorial

Windows operating systems are particularly common on personal computers and servers.

Xdebug 3 WSL2 VS Code Setup

Xdebug 3 WSL2 VS Code Setup

This tutorial shows how to setup Xdebug 3 in WSL2 (Ubuntu 22.04) and VS Code on Windows 11

Most tips on the web for getting Xdebug to play with VS Code and WSL2 are using the php.ini settings from Xdebug 2, which is no longer supported by Xdebug 3.

let’s start Xdebug 3

First go to the Xdebug Installation Wizard. This page helps you finding which file to download, and how to configure PHP to get Xdebug running.

Next after Xdebug 3 is ready in WSL 2, edit the ini file using nano or vi/etc/php/8.1/cli/conf.d/99-xdebug.iniload the module last with 99.

[xdebug]
zend_extension = xdebug.so
xdebug.start_with_request = trigger
xdebug.mode = debug
xdebug.discover_client_host = 1
xdebug.log = /var/log/xdebug.log
xdebug.client_port = 9003

If you are not familiar with the Linux shell, you can also access the WSL file system from Windows to edit the xdebug.ini file. To do this, enter the following line in the explorer address bar to open the folder in which xdebug.ini is located.

\\wsl.localhost\Ubuntu\etc\php\8.1\mods-available

Note. here “Ubuntu” stands for my WSL instance, change it if necessary. The file 99-xdebug.ini is a symlink and points to xdebug.ini.

VS Code WSL extension

Now reopen the workspace/folder using the Remote – WSL extension. To do this, you can bring them up by pressing F1 to open the Command Palette and typing in WSL, or by selecting the green remote indicator in the lower left corner of the status bar and select “Connect to WSL“. You will probably see the suggestion that the WSL extension should be added, just confirm with yes.

Xdebug 3 WSL2 VS Code remote indicatorXdebug 3 WSL2 VS Code status bar

The WSL extension lets you use VS Code on Windows to build Linux applications that run on the Windows Subsystem for Linux (WSL). You get all the productivity of Windows while developing with Linux-based tools, runtimes, and utilities.

At the bottom right of the terminal pane you can see ports that forwarded to localhost port 9003, so VS Code interacts with Xdebug in WSL.

Xdebug 3 WSL2 VS Code Port Forwarded

Add Xdebug launch configuration

Now add PHP: Listen for Xdebug to the VS Code launch configuration with choose Run -> Open Configurations.

        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "stopOnEntry": true,
            "log": true,
            "pathMappings": {
                "/mnt/c/users/<userID>/documents/ubuntu": "${workspaceRoot}"
            }
        }

This the first section “Listen for Xdebug” is needed. If you want to try out more settings, go to my launch.json here.

VS Code Run and Debug

Open the file for debugging in your browser and open it in VS Code, now go to Run and Debug with hit Ctrl+Shift+D and start Listen for Xdebug F5 or click the green arrow and reload the page from the browser.

Xdebug 3 WSL2 VS Code Setup

  A Chrome plugin called Xdebug helper which let you toggle debugging in chrome. You might want to skip temporarily debugging, it also provides profiling and tracing for Xdebug. This add-on is also available for Microsoft Edge did you can get here.

Finalize Xdebug in WSL

Set the owner rights for the web server to the Xdebug log file.

$ chown www-data:www-data /var/log/xdebug.log

Don’t forget to restart the Apache web server.

$ systemctl restart apache2

Troubleshooting

If something went not as expected, the following commands can be helpful for troubleshooting.

How do I know if Xdebug is running? The next command should show the commonly output.

$ php -v
PHP 8.1.2-1ubuntu2.14 (cli) (built: Aug 18 2023 11:41:11) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.14, Copyright (c), by Zend Technologies
    with Xdebug v3.2.2, Copyright (c) 2002-2023, by Derick Rethans

Further can be checked that Xdebug is listening and ready in VSCode.

$ netstat -tulpen | grep LISTEN

If Xdebug is set up correctly and running in VS Code, you should see the following output.

tcp      0    0 127.0.0.1:3306       0.0.0.0:*     LISTEN    110     23618    298/mariadbd
tcp      0    0 127.0.0.1:35883      0.0.0.0:*     LISTEN    1000    22932    800/node
tcp      0    0 127.0.0.53:53        0.0.0.0:*     LISTEN    101     17836    134/systemd-resolve
tcp6     0    0 :::9003              :::*          LISTEN    1000    17992    966/node
tcp6     0    0 :::80                :::*          LISTEN    0       19672    299/apache2

Port 9003 in particular should appear with LISTEN.

Check if Xdebug responds on localhost port 9003 and VSCode is ready to answer queries.

$ nc -vz 127.0.0.1 9003
Connection to 127.0.0.1 9003 port [tcp/*] succeeded!

If you get connection refused may VSCode is not listening!

The Xdebug log file provides information about the process activities.

$ tail -f /var/log/xdebug.log

The Windows firewall can also be temporarily deactivated if necessary.

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

Run as administrator in the PowerShell.

Xdebug 3 and Visual Studio Code

The Lightweight Editor VS Code is a cross-platform editor for developers that differs from integrated development environments (IDE). Like Sublime or Eclipse, Visual Studio Code still supports debugging and autocompletion with IntelliSense. But it does not include integrated compilers and components such as version management.

However, Visual Studio Code makes it possible to adapt the environment (IDE) to the required development workflow. With a variety of extensions, so additional features can be integrated from the marketplace, such as the extension for Connect to WSL and Debug support for PHP with Xdebug. The PHP Hypertext Preprocessor must be provided according to the platform and version.

Start Menu and Taskbar Customize in Windows 11 with Start11

Customizing the Start Menu and Taskbar in Windows 11 and 10 with Stardock Start11

Start Menu and Taskbar Customize in Windows 11 and 10

Stardock Start11 can visually customize the start menu and taskbar of Windows 11 and Windows 10 and enrich it with additional functions and enhanced features.

There are various layouts to choose from and it is possible. For example, to get a classic start menu in the style of Windows 7. Start11 even bring back missing functions from old Windows versions. Start11 version 1.47 is currently available as a free trial version.

Install Stardock Start11

Stardock Start11 can be deployed using the Windows Package Manager as follows. Open a command prompt with hit Windows+R to run cmd

Then ran the following command line.

winget install -e --id Stardock.Start11

Start11 works on Windows 11 and Windows 10 (32-bit/64-bit), but older windows versions are not supported. After installation, the software can be started as a 30-day trial version by providing a valid email address.

Make Windows 11 more individual

Start11 is primarily aimed at those users who are not satisfied with the Windows 11 start menu and would like the old Windows 10 or Windows 7 start menu back. After the start, the software offers four different design templates for this purpose. These can also be further adjusted and, for example, use a compact representation or a grid style.

Additional options to customize

Additional options make it possible to customize the color, transparency and other properties of the start menu. If you want, you can even change the start button. The taskbar can also be given a personal touch by changing the transparency, color, texture and size.

New Start11 Features

However, Start11 not only changes the Windows design, but also brings some useful functions with it. For example, it is possible to place the taskbar back at the top of the screen under Windows 11 and to expand the greatly reduced context menu. A separate search function promises better results than Windows own search and can also filter them by file type and search through file contents.

Start11 can be tested for 30 days free of charge and without any restrictions on the range of functions, after which the purchase of a license key is required. This costs around seven euros for activation on a device.

More alternatives

A similar tool is available with StartAllBack. It gives Windows 11 back the look of Windows 10 or Windows 7. The respective themes can be easily selected, which automatically customizes the start menu, taskbar, icons and command bar in Windows Explorer.

Install StartAllBack

Open a command prompt with hit Windows+R to run cmd

winget install startallback

Taskbar11 open-source tool

If you just want to move the taskbar to the top of the screen. Can do this with the open source tool “Taskbar11”.

The open-source tool can also remove unnecessary icons and optimize taskbar behavior on multi-monitor systems. Taskbar11 is currently available in version 6.0.

Taskbar11 does not require installation and can therefore be run directly after download. The prerequisite is of course Windows 11, so the software does not work with older versions of the operating system.

At the first start, a security warning may have to be confirmed by the Microsoft Defender Smart Screen (first click “More info” and then “Run anyway”).