Set up the PHP development environment (XAMPP + Xdebug + netbeans, configure debugging) and create

Source: Internet
Author: User
Tags php development environment netbeans
The main reference is as follows: No RemoteDebugging environment is set up, leading to low development efficiency. Habitual operations obviously cannot get used to this development mode of notepad IEExplorer. Therefore, we decided to build a PHP development environment for debugging. After reading various materials, I decided to use NBXDebug to build the environment. Because of

The main reference is as follows: a Remote Debugging environment is not set up, leading to low development efficiency. Habitual operations obviously cannot get used to this development mode of notepad IE Explorer. Therefore, we decided to build a PHP development environment for debugging. After reading various materials, I decided to use NBXDebug to build the environment. Because of

The main reference is as follows:

A Remote Debugging environment is not set up, leading to low development efficiency.

Habitual operations obviously cannot get used to this development mode of notepad + IE Explorer. Therefore, we decided to build a PHP development environment for debugging.

After reading various materials, I decided to use NB + XDebug to build the environment. The steps for setting up the environment are cumbersome.

0. Download and install jdk with netbeans (nb)


1. First download NetBeans. The latest version is NetBeans 7.0. Check which PHP plug-in is selected.

For convenience, I downloaded the Full Features version.

Link:

Http://netbeans.org/downloads/start.html? Platform = windows & lang = zh_CN & option = all

2. Download The XDebug version you need.

2.1 preparations

Before that, make sure that you have installed xampp, which is an integrated suite of PHP, Apache, MySql, and Perl. The latest version is 1.7.4 Final. A download link is also provided here.

Http://www.newhua.com/soft/50127.htm

2.2 test the XAMPP installation

If everything is ready, enter http: // localhost: 80 in the browser to check whether Apache and PHP are correctly installed.

You can use phpInfo () to view the PHP feature installation.

2.3 install XDebug

XDebug is only an Extension of PHP. Go to the XDebug official website to download it.

Here we also provide

Http://xdebug.org/download.php

Note that there are a large number of versions, and how to choose to enable the browser again to view the output of the phpInfo function. Depending on the PHP version, the PHP Build Environment (VC6 or VC9), whether it is Thread safe (TS) to select a suitable XDebug version.

3. Configure XDebug.

Modify the XDEBUG p of PHP. ini.

You must enable the following configuration options.

Zend_extension = "XDebug path"

For example, "zend_extension =/php/ext/Php_xdebug-2.1.0-5.2-vc6.dll"

Xdebug. Remote_enable = on
Xdebug. Remote_handler = dbgp
Xdebug. Remote_host = localhost
Xdebug. Remote_port = 9000 // The default value is 9000. We recommend that you set this parameter.

Then restart the Apache service. View the configuration items under XDebug p in phpInfo.

Note: It seems that PHP. ini in XAMPP has been integrated with XDebug, but only commented out. All we need to do is remove the comments.

4. Debug in NetBeans.

Go to NetBeans, create a PHP project, and write PHP code.

Then, use the "debug" menu to set breakpoints, Step into, Step over, and other common menu functions of ms ide.

After the breakpoint is broken, you can also see Windows for viewing variable values such as Watch and Local. Is it quite enjoyable? From now on, you can develop a PHP program to say goodbye to the simple notepad + browser mode. Has a php ide that is comparable to the VS development environment. More importantly, these tools are free of charge.

The procedure is simple.

In fact, xampp has already been set, but it is just a comment.

Open php/php. ini in the xampp installation directory

Find

[XDebug]
Zend_extension = "D: \ xampp \ php \ ext \ php_xdebug.dll"

Remove comments from this line (start this line)

And add:

Xdebug. remote_enable = true
Xdebug. remote_handler = dbgp
Xdebug. remote_host = localhost
Xdebug. remote_port = 9000

(In fact, the following statements indicate that you need to add them)

Restart apache

The following is the first php project to be created:

1. Create a PHP Project
1) Select File> New Project.
2) Select PHP> PHP Project from the dialog box and enter the Project name firsttest.
3) In Configured server, select localhost and input/test in Context Path.

2. Edit the PHP File
Expand Source Files, double-click the index. php file, and enter the test code.
In Input phpinfo ();
You can use Ctrl + Space to complete the code.

3. Run the project
Right-click the project node and choose run project to view the running result of phpinfo.

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.