Methods and steps for remote debugging of aptanastudio3+php program

Source: Internet
Author: User

PHP is the execution of the script on the server, usually debugging bugs, directly in the browser page can print out the error message, which basically can solve all the bugs, but sometimes, it can be said that most of the time, PHP will directly handle the client's request, as a data interface to pass data, there is no UI interface, This is very difficult to debug the complex logic, of course, you can use log, all the running information to print to an external text, but accustomed to the IDE breakpoint stepping in our original approach is unacceptable. The following describes the use of popular xdebug to remote debugging, to achieve the purpose, if there is a client (mobile phone app,pc application, browser ...) Request PHP, then you need to automatically stop at my PHP breakpoint, and show the values of all variables in real time, the pointer changes.

First step: Download Xdebug

  Download Xdebug program DLL, before downloading, write a PHP, code on these.

1 <? PHP 2   Phpinfo (); 3 ?>

Open this PHP on your browser, press CTRL + A and press CTRL + C to copy the entire page, so copy:

Open this URL in the browser:http://xdebug.org/wizard.php, in the large text box of the page Ctrl + V, copy the contents of the above copy in

Nothing, just click the button in the Red box, wait, the page will appear:

Download the above box-selected DLL and record the row below the box selected

Zend_extension = C:\WebEnvironment\php-5.5.5\ext\php_xdebug-2.3.2-5.5-vc11-x86_64.dll

So far, we're ready for the xdebug.

Step Two: Configure Xdebug

Open the PHP directory, locate the Ext folder, and copy the downloaded Xdebug DLL.

Open the php.ini file and add these configuration codes to the end of the file:

[XDebug]
Zend_extension = C:\WebEnvironment\php-5.5.5\ext\php_xdebug-2.3.2-5.5-vc11-x86_64.dll
; whether to turn on automatic tracking
Xdebug.auto_trace= on
; whether to turn on exception tracking
Xdebug.show_exception_trace= on
; whether to turn on remote debugging auto-start
Xdebug.remote_autostart= on
; whether to turn on remote debugging
Xdebug.remote_enable= on
; Allow client IP to debug
Xdebug.remote_host=localhost
; Remote debugging port (default 9000)
xdebug.remote_port=9000
; Debug Plugin DBGP
Xdebug.remote_handler=dbgp
; whether to collect variables
Xdebug.collect_vars= on
; whether to collect return values
Xdebug.collect_return= on
, whether to collect parameters
Xdebug.collect_params= on
; Whether to open debug content
Xdebug.profiler_enable=on

After the above code is added, turn off php.ini and restart Apache. So far, we have set the Xdebug.

Step three: Use Xdebug in Aptanastudio

Click Ok->ok directly, close the dialog box, the configuration is complete.

Fourth Step: Debug The Program

Here is a program that uses Plupload to upload large files. First I want to open Aptana (no IDE can not debug oh ^_^), open my upload file upload.php (after the client uploads successfully, the PHP to process the file, such as file block merge to write to a local server directory, etc.).

After the client uploads successfully, my aptanastudio directly to the debugging interface (the first use of this feature may have a query to enter the Debugging dialog box, confirm and remember the operation, the next time directly into the debug state)

Upload on the code:

After the front-end upload is complete, there will be a blue arrow pointing to the first line of my PHP code, pressing the bug-like button at the far right of the toolbar to manually cut into the debug state.

So far, you can debug, any front-end requests for the PHP script can enter the debugging environment in the IDE, let us control whether the PHP script continues to execute, you can see the changes in real-time variables, is not the same as all other debug environment.

Note: Other PHP development environments, such as Zendstudio,eclipse,sublime, can be configured with the above method to configure the Xdebug debug environment, as these Ides are based on eclipse modifications

Methods and steps for remote debugging of aptanastudio3+php program

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.