Eclipse development PHP environment Configuration

Source: Internet
Author: User
Tags php debug

 

First, prepare the software:

1. Apache. Find the latest version here.

2. Download PHP from here

3. Eclipse IDE for Java EE Developers, download it here

4. DLTK Core Frameworks 1.0 Integration build, download it here

Note: DLTK is a dynamic Language Development Kit. PDT depends on it. I wonder why the stable version on the official homepage has dropped from 1.0 to 0.95, and PDT must be running on 1.0, select the latest Integration version (at the bottom of the page) instead of the Release or Stable version.

5. Download PDT 2.0 from here

6. Zend Debugger. Download it here.

 

Install and configure the software.

First, install and configure the Apache and php environments.

Not to mention installation. Apache is an msi file, and php only needs to be decompressed.

Configuration is annoying. The steps are as follows:

1. Edit php. ini

1) extension_dir = "./" changed to extension_dir = "C:/php-5.2.6/ext"
2); extension = php_mysql.dll "and"; extension = php_gd2.dll ", remove the semicolon above, and change extension = php_mysql.dll to extension = php_mysql.dll.
Change; extension = php_gd2.dll to extension = php_gd2.dll
3) Save php. ini and restart apache.

2. Modify httpd. conf in Apache/conf and add the following content at the end of the file:

LoadModule php5_module "C:/php-5.2.6/php5apache2_2.dll"
AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps
Action application/x-httpd-php "/php/php-cgi.exe"
AddType application/x-httpd-php. html
AddType application/x-httpd-php. htm
Adddefacharcharset UTF8

PHPIniDir "C:/php-5.2.6"

 

3. Add the following in the Path setting of the environment variable:

C: \ php-5.2.6; C: \ php-5.2.6 \ ext

 

After the above configuration, create a php test file index. php In the Apache/htdocs directory as follows:

<? Php

Phpinfo ();
?>

Remember to restart Apache.

Open IE and enter http://www.bkjia.com/index. php in the address bar. If it works, it means php and apache can work.

 

Then, configure the PHP development and debugging environment for Eclipse.

1. Install Eclipse. decompress it to a directory.

2. Install DLTK.

Extract the downloaded file to a directory, such as: F: "PHP" PDT "dltk-core-I-I200809081043-200809081043-incubation, start Eclipse-> Help-> Software Updates-> Available Software-> Add Site-> Local-> select the extract directory and install it.

3. Install PDT2.0

The installation of the root DLTK is similar.

4. Install ZDebugger

The result of explain is as follows:

1) Select ZendDebugger. dll from the 5_2_x_comp directory, copy to C: \ php-5.2.6 \ ext

2) Add the following in the php. ini file:

Zend_extension_ts = C: // php-5.2.6/ext/ZendDebugger. dll
Zend_debugger.allow_hosts = localhost, 127.0.0.1

Zend_debugger.expose_remotely = always

3) copy the dummy. php file to C: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs.

5. Configure Eclipse and Apache

1) Configure Apache:

For example, if I place all Eclipse projects under E: \ EclipseWorkspace, modify Apache/conf/httpd. conf and add the following at the end of the file:

Alias/Workspace/"E:/EclipseWorkspace /"
<Directory "E:/EclipseWorkspace/">
Options Indexes MultiViews
AllowOverride None
Order allow, deny
Allow from all

</Directory>

The advantage of doing so is that all php projects share an apache configuration (see how to set it below ).

2) Configure Eclipse:

Open Eclipse-> Window-> Preferences-> PHP:

Set PHP Executables-> Add as follows:

 

Set PHP Servers-> New as follows:

 

Note that the Workspace is added to the URL bar. This is the directory alias added in httpd. conf.

PHP Debug, as shown in, select the appropriate Debugger and Server

 

So far, the configuration is complete.

Remember to restart Apache again.

Finally, create a test program to see how it works:

Create a new PHP Project named FirstPHPTest. Of course, we use E: \ EclipseWorkspace as the Eclipse workspace directory.

Create a new PHP File in the project, such as using the index. php above.

When you right-click "Run As-> php Web Page" on index. PHP, the following figure is displayed:

 

Come here, take a rest.

 


Author sayo.net

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.