From the Terminal

Installing XDebug on anything for VSCode in 5 minutes (XDebug 2.x)

Update 2/25/2021: This guide is for XDebug 2.x only.

For XDebug 3.x click here.

I see a lot of over complicated guides on XDebug so I'll simplify things real quick for everyone.

Visual Studio Code has debugging support out of the box. Click on the Debug icon in the left bar (OS X: ⇧⌘D, Windows / Linux: CTRL+SHIFT+D) then click on the cog icon which should open your launch.json file or create one if none exists.


You must have the PHP XDebug extension installed of course.

Now add this to your launch.json file you have open:

        {
            "type": "php",
            "request": "launch",
            "name": "Listen For XDebug",
            "port": 9000,
            "pathMappings": {
                "/var/www/": "${workspaceRoot}"
            },
            "xdebugSettings": {
                "max_children": 256,
                "max_data": -1,
                "max_depth": 5
            },
            "ignore": [
                "**/vendor/**/*.php"
            ]
        }

Make sure you change /var/www/ to where your code is on your local server.

Set this in your php.ini

[xdebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.profiler_enable_trigger = 1

You might need to do it twice. Once for CLI and once for PHP-FPM!

 

Typical locations for your php.ini file:

  • Linux: /etc/php/{$version}/php.ini
  • macOS (Homebrew): /usr/local/etc/php/{$version}/php.ini

Don't forget to restart php-fpm!

Now start the debugger by hitting the green play button.

Infinity

I always think about how if you count from one to infinity; within that infinity of numbers exists every movie, book, photograph, software or game, video, song or sound, work of art, insignificant doodle, and master piece of conscious thought in every file format you can image and yet to be invented and never to be invented.

All of that is in this simple loop

i=1;while(i) { i++; }

Running Multiple Instances of Discord in Linux

In Linux Discord stores it's data in XDG_CONFIG_HOME which is ~/.config by default. It also uses /tmp for a discord.sock file which it uses to determinate if there is already a running process.

Simply set both TMPDIR and XDG_CONFIG_HOME to an alternative and launch discord.

/bin/bash -c "export XDG_CONFIG_HOME=~/.nya; export TMPDIR=~/nya; /opt/discord/Discord"

In Gentoo Discord installs to /opt so change that to your location.

Solving Dependency Slot Conflicts in Gentoo Elegantly

Sometimes when you want to emerge something or upgrade something you will have dependency slot conflicts like this example.

 

To fix this problem you'd need to emerge all kde-frameworks/* packages you currently have installed to upgrade them all at once since it's all part of one framework.

The following commands let you do so with ease.

equery l kde-frameworks/* -F '$category/$name'

 

The output of which you can send right into emerge like so.

sudo emerge --ask -1 --verbose-conflicts $(equery l kde-frameworks/* -F '$category/$name')

 

Now you'll hopefully get a clean emerge.