PHP development debugging environment configuration, php development debugging _ PHP Tutorial

Source: Internet
Author: User
Tags php development environment
PHP development debugging environment configuration, php development debugging. PHP development debugging environment configuration, php development debugging is based on wamp and EclipseforPHPDevelopers introduction in order to build a PHP development debugging environment, I have read numerous materials online, but no PHP development debugging environment configuration, php development and debugging

-- Based on wamp and Eclipse for PHP Developers

Introduction

In order to build a PHP development and debugging environment, I have consulted countless materials on the Internet, but there is no practical solution. Because the PHP development environment requires the cooperation of many types of software, the versions of the software must match each other, and it is hard to say how to match the specific method, as for the matching between the latest software versions, there is a lack of relevant information. Even if there is a slight version mismatch between versions, the final result will be futile.

However, through unremitting persistence and efforts, after the failure again and again, we finally completed the PHP development and debugging environment at half past one AM. after seeing the webpage running, eclipse automatically enters the breakpoint, I don't know how excited I was. In order to avoid detours for new PHP beginners (I am actually a newbie, but I still don't understand the PHP syntax at all), I will summarize the setup process and hope to help my friends.

System environment

XP SP3

WampServer

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

Under me is

It contains four required software for building PHP:

Why is WampServer used?

If you install these software separately, it is troublesome to install the software one by one. Secondly, you must configure each software. third, the versions of the software you install may not match each other; at last, due to version inconsistency, there may be slight differences in configuration. The use of WampServer is much better. It includes all the software for building the PHP development and debugging environment, and requires a very small number of configurations. of course, you do not need to consider matching between versions. Finally, the use of WampServer is also because I tried to install each of the software N times before failing to use a one-stop service of WampServer.

Eclipse for PHP Developers

: Http://www.eclipse.org/downloads/packages/eclipse-php-developers/heliossr1

I have the following 32-bit:

This is an IDE provided by eclipse for PHP developers. for those who are used to eclipse development, it is better to use it to develop php. Of course, after all the software is installed, we need to debug some PHP configurations for this IDE. we will discuss this later.

Install software and install WampServer

You only need to continue to the next step. you can set a single smtp configuration.

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

Directory structure after installation:

We can find that the three basic software apache, php, and mysql are all in the bin folder under the installation directory. In addition, the www directory is the website directory of the apache server. After Eclipse for PHP Developers is installed, the workspace will be set to this directory.

Install Eclipse for PHP Developers

You only need to extract the package to the corresponding location on the hard disk.

I decompress it to D: \ software \ develop \ php \ eclipse. you can customize the location based on your preferences.

Configure WampServer

Click the icon in the lower-right corner of the screen. the options are all in it:

Open short open tag and load apache rewrite module

Apache configuration

Because IIS is installed on my machine and port 80 is occupied, I need to modify the default port of apache to 81.

Go to C: \ wamp \ bin \ apache \ Apache2.2.21 \ conf, open httpd. conf, find the line Listen 80, change it to Listen 81, and save. Restart apache.

Enter http: // localhost: 81/in the browser and you will see the following interface:

It contains all the features of our wamp server. Click the phpinfo () link to view the php Installation status.

Xdebug configuration

Xdebug must be manually downloaded and configured for many materials on the internet. However, this version of WampServer already contains Xdebug (under C: \ wamp \ bin \ php \ php5.3.8 \ zend_ext ), and it is automatically configured. So we basically don't need to configure anything. The only thing we need to configure is to open php under C: \ wamp \ bin \ apache \ Apache2.2.21 \ bin. ini, find xdebug in the last few lines. remote_enable = off, changed to xdebug. remote_enable = on. This is done to enable Breakpoint during eclipse debugging.

Click the phpinfo () link in http: // localhost: 81/. if the following information exists, xdebug is correctly installed:

Eclipse for PHP Developers configuration

First, you need to configure jdk. first, install the jdk package and set the environment variables. there are too many configuration articles on the internet. you can refer to the configuration.

The focus of this article is to make Eclipse for PHP Developers support PHP debugging. next we will look at how to configure PHP in Eclipse for PHP Developers:

Configure workspace

To open Eclipse for PHP Developers, you need to set the workspace. this must be set to the www directory of wamp; otherwise, debugging will not be available. My www directory is C: \ wamp \ www

Configure the debugging environment

Go to Eclipse -- Window-Preferences

Set PHP Executable. Note the path of PHP. INI. the path here is unique in the wamp server under the apache Directory.

Configure PHP Server

Set the PHP Server to the default one. since we changed the apache port to 81, we also need to modify it here:

Configure debug

Set the browser for debugging

Because the built-in browser is used for debugging by default, it is inconvenient, so I changed to chrome:

Start Debugging and create a project and test page

Create a PHP project and create the my. php test page.

Write test code

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

Start Debugging

The PHP WebPage method is used for debugging. you need to set xdebug. remote_enable = on in php. ini under C: \ wamp \ bin \ apache \ Apache2.2.21 \ bin to enable remote debugging. Of course, this step has been configured in the previous Xdebug configuration.

Debugging result

After debugging is started, the chrome browser is automatically started and

Http: // localhost: 81/test1/my. php? XDEBUG_SESSION_START = ECLIPSE_DBGP & KEY = 13380120483901, and automatically enters the breakpoint:

After the execution is completed, the page displays the following results:

Summary

Now, even after the PHP development and deployment environment is officially completed, we can see that the process is very complicated and complicated. However, as a qualified developer, we should be determined and confident to solve it, we will accumulate valuable experience in this process. I hope this document will help you. thank you!

Author based on wamp and Eclipse for PHP Developers introduction in order to build a PHP development and debugging environment, I used to read numerous materials online, but no...

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.