PHP Development Debug Environment configuration

Source: Internet
Author: User
Tags php server php development environment phpinfo

--based on Wamp and Eclipse for PHP developers

Introduction

In order to build a debugging environment for PHP development, I have been on the Internet access to countless information, but there is no real way to pass. Because the PHP development environment requires many kinds of software to match each other, the software version must be matched to each other, and exactly how the matching method is hard to say, as for the latest version of the software to match each other more lack of relevant information. Even if there is a minor version mismatch between versions, the final result will be futile.

However, through unremitting perseverance and efforts, after failure again and again, finally at 1:30 A.M. PHP Development Debugging environment all set up, see Run the webpage, Eclipse automatically entered the breakpoint that moment, my heart don't mention how excited. For PHP Novice Less detours (in fact, I am also a novice, PHP grammar also do not understand it), I will build the process summed down, I hope to help friends.

System environment

XP SP3

Software Preparation Wampserver

: http://www.wampserver.com/en/#download-wrapper

I'm down.

It contains the 4 necessary software to build PHP:

    1. Apache 2.2.21
    2. Php 5.3.10
    3. Mysql 5.5.20
    4. XDebug 2.1.2
    5. Some ancillary software.

Why use Wampserver?

Because if you install the software separately, the first one is a cumbersome installation, followed by the configuration of each software, and the third is that the software you install may not match each other, and finally, due to the version inconsistency, there may be subtle differences in configuration. The adoption of Wampserver is much better, it contains all the software to build a debugging environment for PHP development, and there are very few places to configure, of course, you do not need to consider the version of the matching problem. Finally, the reason for the use of wampserver, but also because I have tried to install each of the software has failed, only after the pain determined to use one-stop service wampserver.

Eclipse for PHP Developers

: HTTP://WWW.ECLIPSE.ORG/DOWNLOADS/PACKAGES/ECLIPSE-PHP-DEVELOPERS/HELIOSSR1

I'm under the 32-bit:

This is an IDE provided by Eclipse for PHP developers, and it is no better to use it to develop PHP for a friend who is accustomed to using eclipse development. Of course, after each software is installed, we also need to debug PHP for the IDE to do some configuration, this we will say later.

Installing the Software Installation Wampserver

This is as long as the next step is OK, the setting of SMTP can be set to a random.

After the installation is complete, my installation directory is:C:\wamp

After the installation of the directory structure:

Can be found: We need 3 basic software Apache, PHP, MySQL are in the installation directory in the Bin folder. In addition, the WWW directory is the web directory of the Apache server and will be set to this directory after eclipse for PHP developers is installed.

Install Eclipse for PHP developers

This only needs to be decompressed to the corresponding location on the hard disk.

I unzipped it to the D:\software\develop\php\eclipse, and you can customize the location to your liking.

Configuring the Software configuration Wampserver

Left click on the bottom right of the screen icon, the options are all inside:

Open the short open tag and load the Apache rewrite module

Configuration of Apache

Since IIS is installed on my machine, I have 80 ports, so I need to modify Apache's default port to 81

Enter C:\wamp\bin\apache\Apache2.2.21\conf, open httpd.conf, find listen 80 this line changed to listen 81, save. Restart Apache.

At this point, enter in the browser: HTTP://LOCALHOST:81/will see the following interface:

It contains all the functions of our Wamp server. Click the Phpinfo () Link to view the installation of PHP

Configuration of the Xdebug

A lot of information on the Internet to manually download Xdebug and configuration, but this version of the Wampserver contains Xdebug (located under C:\wamp\bin\php\php5.3.8\zend_ext), and automatically configured. So we basically do not need to configure what, the only thing to match is to open the C:\wamp\bin\apache\Apache2.2.21\bin under the php.ini, find the last few lines of xdebug.remote_enable = off, Change to xdebug.remote_enable = on. This is done to allow you to enter breakpoints when debugging in Eclipse.

Click the Phpinfo () link in http://localhost:81/, and if you have the following information in it, Xdebug is installed correctly:

Configuration for the Eclipse for PHP developers

First need to configure the JDK, this need to install the JDK package, and then set the environment variables, there are too many configuration articles on the Web, you can refer to the configuration.

The point of this article is to let Eclipse for PHP developers support PHP debugging, and let's look at how to do PHP configuration in Eclipse for PHP developers:

Configure workspace

To open eclipse for PHP developers, you need to set the workspace, which must be set to the Wamp www directory, otherwise you will not be able to debug. My www directory is C:\wamp\www.

Configuring the Debugging Environment

Into Eclipse--window–preferences

Set PHP executable. Need to be aware of the path to the php.ini, where the path is Wamp server, which is placed in the Apache directory

Configure PHP Server

PHP server is set to the default, because we changed the port of Apache to 81, so we have to make corresponding changes:

Configure Debug

Setting up a browser for debugging

Because the default is to use the built-in browser for debugging, it is inconvenient, so I changed into a custom chrome:

Start debugging Create engineering and test pages

Create a PHP project and create a my.php to do a test page

Writing test Code

Enter the following code in my.php and add a breakpoint to the second line:

Start debugging

This is done using PHP webpage mode for debugging, you need to set C:\wamp\bin\apache\Apache2.2.21\bin under PHP.ini xdebug.remote_enable= on, which means remote debugging is enabled. Of course this step has been xdebug in the previous configuration.

Debug results

When you start debugging, the Chrome browser starts automatically and opens automatically

http://localhost:81/test1/my.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=13380120483901 this page and automatically enters a breakpoint:

After execution, the page displays the effect:

Summary

At this point, the development and deployment of PHP environment, even if formally finished, you can see that the process is very complicated and cumbersome, but as a qualified developer, we should have the determination and confidence to take it, in this toss-up process we will accumulate valuable experience. I hope this document will be helpful to everyone, thank you!

PHP Development Debug Environment configuration

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.