Configure Xdebug in PHPStorm

Source: Internet
Author: User
PHPStorm Xdebug configuration this tutorial applies to users of the Laravel project and uses Homestead as the virtual machine in the development environment by default.

1. confirm that you have installed Xdebug

Log on to your homestead through ssh and execute

ls /etc/php5/fpm/conf.d

If you see the configuration items of 20-xdebug.ini, Xdebug is correctly loaded, for example:

2. configure xdebug. ini

Run the following command to enter the directory where xdebug. ini is located:

cd /etc/php5/mods-available

You can use vim to edit zend_extension = xdebug. so and add the following lines under the line:

xdebug.remote_enable = onxdebug.remote_connect_back = onxdebug.idekey = "vagrant"

Save, exit, and restart php-fpm.


sudo service php5-fpm restart
3. configure PHPStorm

Open your Laravel project in PHPStorm, press cmd +, set outbound call preferences, find the Servers under PHP, and configure as follows:

/path/to/laravel        ==> /home/vagrant/path/to/laravel/path/to/laravel/public ==> /home/vagrant/path/to/laravel/public

The configured folder varies depending on the files mapped by Homestead. yaml. Apply.

Go back to the navigation bar, find Run-> Edit deployments, and add a PHP Web Application.

4. test

Write an instance code in app/routes. php:

Route::get('/', function(){    $a = [1, 2, 3, 4, 5];    array_pop($a);});


Then add a breakpoint to each line, Run --> Debug, and select the previously set Homestead. if you see it, congratulations.

Happy Hacking

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.