Methods of Drush scripts in vagrant virtual machines through Xdebug remote debugging in the host

Source: Internet
Author: User
Tags drupal

The method is to debug the PHP code executed by the Drush method, the same applies to the normal CLI mode of running PHP program debugging.

1, first need to adjust the CLI mode Xdebug.ini configuration:

sudo vi/etc/php5/cli/conf.d/xdebug.ini

[xdebug]zend_extension= "/usr/lib/php5/modules/xdebug.so" xdebug.coverage_enable=0xdebug.default_enable= 0xdebug.remote_enable=1xdebug.remote_connect_back=onxdebug.remote_host=192.168.xxx.xxxxdebug.remote_port= 9000xdebug.remote_handler=dbgpxdebug.remote_log=/tmp/xdebug.logxdebug.remote_autostart=falsexdebug.idekey= " Phpstorm "xdebug.max_nesting_level=256

One of the

Xdebug.remote_host=192.168.xxx.xxx
Need to change to your host's IP address

2. Create a script file named drush_debug.sh, which sets the variables required for CLI debugging, for convenience, drush_debug.sh directly under the root directory of the Drupal project, and then copy the following contents drush_debug.sh, and save.

#!/bin/bashexport xdebug_config= "Idekey=phpstorm" &&  export php_ide_config= "Servername=drupalvm.dev" &&drush "[Email protected]"

After saving is complete, use the chmod command to modify the drush_debug.sh so that it has execute permissions.

3, Configuration Phpstorm

About the note:

1). To ensure that the name of the server and the servername of the second step are consistent

2). Tick use path mapping, set absolute path on the server to the directory where the Vagrant virtual machine Drupal project resides.

4. Run Drush command

Enter the directory where Drupal is located, use drush_debug.sh instead of the original drush can be debugged, remember where you need to set a good breakpoint.

5, if the normal CLI debugging, the 2nd step of the

Drush "[Email protected]"
Change into
PHP "[Email protected]"
You can do it.

Because it is very simple, no detailed instructions are made.

6. Instructions for vagrant file synchronization under Windows:

The local path of the Config.vm.synced_folder in Vagrantfile can take the path relative to the file where the Vagrantfile is located, and it is not necessary to install the NTFS plug-in to support the synchronous type to write directly to NFS.

How to Drush scripts in vagrant virtual machines through Xdebug remote debugging in a host

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.