PHP learning-use XDebug (Ubuntu) in sublime)

Source: Internet
Author: User

PHP learning-use XDebug (Ubuntu) in sublime)
I am ashamed to say that since I started using Sublime Text, I have never debug PHP code. I recently set up the debug environment and record it here. Install the XDebug sudo apt-get install php5-xdebug to edit xdebug. INI file, add the following configuration xdebug. remote_enable = 1xdebug. remote_handler = dbgpxdebug. remote_host = 127.0.0.1xdebug.remote _ port = 9000xdebug. remote_log = "/var/log/xdebug. log "restart nginx sudo/etc/init. d/nginx restart: Use package control to Install xdebug client in Sublime Text, press ctrl + shift + p to bring up the search box, and enter Package Control: Select Package Control: Install Package, enter Xdebug client and find xdebug clien. T. install it. Restart Sublime after installation. To debug a project, you must first save the project as a project under sublime. Sublime-> project-> save project... next, configure the project sublime-> project-> edit poject. The configuration file is similar to the following: copy the code {"folders": [{"follow_symlinks": true, "path ":". "}]," settings ": {" xdebug ": {" url ":" http://my.local.website/", }}} copy the code and install the chrome Xdebug Helper extension in Chrome. After downloading and installing Chrome extensions, you must restart your browser. After restarting, you will see the new icon in the address bar of Chrome: Click it to enable/disable debugging. However, we first need to adjust the session key that uses Sublime Text in the extension. Open Xdebug helper options in Chrome Tools> Extensions: it is easy to enable debugging, right-click the place where you want to Add a breakpoint, and choose xdebug-> Add/Remove breakpoint. The project stops running on the current line and starts debugging, on the menu bar, choose tools> xdebug> start debugging (launch browser) sublime. the browser is automatically opened, and the link to the website written during configuration is displayed for debugging. You can right-click the functions used in debugging in the debugging file to view them. The shortcut keys are as follows: Start/Stop debugging sessionStart Debugging-Ctrl + Shift + F9 or merge + Shift + F9Start Debugging (Launch Browser) restart SessionStop Debugging-Ctrl + Shift + F10 or combine + Shift + F10Stop Debugging (Launch Browser) Stop Debugging (Close Windows) breakpointsAdd/Remove Breakpoint-Ctrl + F8 or combine + F8Set Conditional Breakpoint-Shift + F8Clear BreakpointsClear All BreakpointsWatch expressionsSet Watch ExpressionEdi T Watch ExpressionRemove Watch ExpressionClear Watch ExpressionsSession commandsEvaluateExecuteStatusContinuation commandsRun-Ctrl + Shift + F5 or continue + Shift + F5Run To LineStep Over-Ctrl + Shift + F6 or continue + Shift + F6Step Into-Ctrl + shift + F7 or values + Shift + F7Step Out-Ctrl + Shift + F8 or values + Shift + F8StopDetachOtherRestore Layout/Close Windows-Ctrl + Shift + F11 or values + Shift + F11Settings-DefaultSettings -User issues cannot be traced to breakpoints This may be because the xdebug port is occupied. Press Ctrl + 'or the menu bar View-> show Console to View the error message. It may be because the xdebug port is occupied. Disable debugging in sublime xdebug or restart sublime to solve this problem. If not, you can modify the port number, such as xdebug. change the port number in ini to 1000. Add the following content to the perferences-> package settings-> xdebug-> setting-user File: {"port": 10000}

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.