How do I debug PHP code in Sublime+chrome?

Source: Internet
Author: User
Tags sublime text

1. Build PHP Local running environment specific click How to use phpstudy local build multi-site (each site corresponds to a different port)

2. Download php_xdebug.dll,

"PHP version 5.3 or above"Http://pecl.php.net/package/xdebug

"PHP version 5.3 and below"http://pecl.php.net/package/xdebug/2.2.7/windows

Note that the version should correspond, or it may not work.

3. Install the PHP xdebug extension (i.e. add the following code in the configuration php.ini file)

[XDebug]   = "D:\phpStudy\php53n\ext\xdebug\php_xdebug.dll"  xdebug. remote_enable = on  xdebug . Remote_handler = "DBGP"  xdebug. Remote_host = "127.0.0.1"  xdebug. Remote_port = 9000  
D:\phpStudy\php53n\ext\xdebug\php_xdebug.dll This path is for reference only, depending on the path you have stored locally.
Create a new PHP file in your local test environment, type
<?php
Phpinfo ();
?>
Then view the page in the browser,

If the result is similar to the red box code that the PHP xdebug extension installation is successful, or you can check the next step of the problem.

4. Install xdebug helper 1.4.2 Extension for Google Chrome (go to Baidu Search to download and install it), after installation is completed as follows:

Install browser plugin Debug PHP
Install the chrome plugin. Xdebug Helper Configuration Xdebug Helper. Open the Chrome extensions option.
Configuration:

Save, restart the chrome

5. In the sublime text shortcut key ctrl+shift+p The package control input install enter confirm. :

6.sublime open a. php file. Select a row by pressing Ctrl + F8 to set a breakpoint, and the shortcut key to delete the breakpoint is also Ctrl + F8

Open the chrome input localhost/php101/test.php My example address:

Click the Xdebug plugin in the Chrome browser address bar and select the first item.

Back to sublime PHP code interface Press ctrl+shift+f9 to start debugging, back to Chrome press F5 refresh , and then to the sublime interface will see such as debug code

Press Ctrl+shif+f5 to execute to the next statement, Ctrl+shif+f6 executes to the next breakpoint.

Sublime Exit Xdebug Press Shift+alt+1

How do I debug PHP code in Sublime+chrome?

Related Article

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.