To teach you how to configure xdebug_php skills in Phpstorm.

Source: Internet
Author: User
Tags fpm

This tutorial applies to users of Laravel projects and uses homestead as the virtual machine for the development environment by default.

1. Confirm that you have installed the Xdebug

By ssh logging in homestead to your, executing

ls /etc/php5/fpm/conf.d

If you see 20-xdebug.ini the configuration item, the description Xdebug is loaded correctly, as shown in the following figure:

2. Configure Xdebug.ini

Enter your directory by using the following command xdebug.ini :

cd /etc/php5/mods-available

You can use Vim to edit it, zend_extension=xdebug.so adding the following lines below a line:

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

Save, exit, and then rebootphp-fpm


sudo service php5-fpm restart

3. Configure Phpstorm

Open your Laravel project in Phpstorm, click on the cmd + , exhale preferences, find PHP Servers it below, and configure it as follows:

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

The folders configured here correspond to the Homestead.yaml files that are mapped. When you are finished setting, Apply.

Then go back to the navigation bar, find Run -> Edit Configurations it, add one PHP Web Application . As shown in figure:

4. To test

To app/routes.php write an instance code:

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


Then add a breakpoint to each row, then Run --> Debug , select the previous set Homestead , and if you see the image below, congratulations.

The above mentioned is the entire content of this article, I hope you can enjoy.

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.