![]() ![]() Finally, SSH into the VM executing `vagrant ssh`.īy default, DrupalVM will use the Drupal composer template project to get a copy of Drupal. Otherwise, you can start and reprovision the VM in a single command: `vagrant up –provision`. If the virtual machine is running, execute the command: `vagrant provision`. If you had already created the VM, you can still make changes to the `config.yml` file and then reprovision. Start the virtual machine by executing `vagrant up`. Keep the terminal open are going to execute various commands from there. Then, open a terminal and change directory to where the DrupalVM files are located. These last two settings are very important for being able to debug Drush commands. Finally, set `php_xdebug_default_enable` to `1` and `php_xdebug_cli_disable` to `no`. Drupal Console is not necessary for getting XDebug to work, but it offers many code introspection tools that are very useful for Drupal debugging in general. In the `installed_extras` section, uncomment `xdebug` and `drupalconsole`. The plugin will make sure that an available IP is assigned to the VM. If you are unsure, you can set the value to `0.0.0.0` and install the `vagrant-auto_network` plugin. Set `vagrant_ip` to an IP that has not been taken by another virtual machine. The `vagrant_hostname` is the URL you will enter in your browser’s address bar to access the Drupal installation. # Make sure the following three get installed by uncommenting them. # All the other extra packages can remain enabled. # Otherwise, use an IP address that has not been used by any other virtual machine. # For dynamic IP assignment the 'vagrant-auto_network' plugin is required. In this file make the following changes: # config.yml file The latter will be used by DrupalVM to configure the virtual machine (VM). Before creating the virtual machine, make a copy of `` into a new file named `config.yml`. If you downloaded a compressed file, expand it to have access to the configuration files. Getting DrupalVMįirst get a copy of DrupalVM by cloning the repository or downloading a ZIP or TAR.GZ file from the available releases. If you need help with those, refer to the DrupalVM’s installation guide. For this article, it is assumed that VirtualBox, Vagrant, and Ansible are already installed. Refer the the official DrupalVM documentation for detailed installation and configuration instructions. Screenshots and referenced on-screen text might be differ in new versions of the different tools. Important: User interfaces tend to change. And then, via the user interface using a browser. First, via the command line using Drush commands. In today’s article we are going to learn how to configure XDebug inside DrupalVM to connect to PHPStorm. Using a proper debugger is definitely the best way to debug Drupal be it migrations or other substems. ![]() This proves our breakpoints work as intended, and Xdebug has been successfully set up.In recent articles, we have presented some recommendations and tools to debug Drupal migrations. Our $a array has one less element due to the array_pop operation we performed. Clicking the Resume button once more produces a slightly different output: Also notice you can expand it to see what it contains. Clicking the Resume button moves on to the next breakpoint and produces the following output: You’ll notice in the right panel that only the superglobals are declared – no other variables are present at this time. The left frame lists the stacktrace – the files the request already went through – and stops at routes.php, our file. A new tab should launch and immediately return you to PHPStorm with an output similar to this one: Then, go to Run -> Debug and run your predefined debug configuration. If you have the app open in your browser, close that tab now, otherwise PHPStorm won’t be able to re-run it. Then, put a breakpoint next to each line of the closure that does something, like so: ![]() In app/routes.php, alter the home route’s closure so that it looks like the code below: Route :: get ( '/', function ( ) ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |