Home  >  Article  >  Backend Development  >  Eclipse development PHP environment configuration_PHP tutorial

Eclipse development PHP environment configuration_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:47:18788browse

First prepare the software:

1. Apache, go here to find the latest version

2. PHP, download here

3. Eclipse IDE for Java EE Developers, download here

4. DLTK Core Frameworks 1.0 Integration build, download here

Note: DLTK is the so-called dynamic language development kit, and PDT depends on it. I don’t know why the stable version on the official homepage has dropped from version 1.0 to 0.95, but PDT must run on 1.0, so please choose the latest Integration version (at the end of the page below) rather than the Release or Stable version.

5. PDT 2.0, download here

6. Zend Debugger, download here

Let’s start installing and configuring these software.

First, install and configure Apache and php environments.

Not much to say about installation, Apache is an msi file, and PHP only needs to decompress it.

Configuration is a bit cumbersome, the steps are as follows:

1. Edit php.ini

1) extension_dir = "./" Modified to extension_dir = "C:/php-5.2.6/ext"
2) ;extension=php_mysql.dll" and ";extension=php_gd2.dll", remove the preceding semicolon, that is, 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 under Apache/conf and add:

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
AddDefaultCharset UTF8

PHPIniDir "C:/php-5.2.6"

3. Add under the Path setting of the environment variable:

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

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 in the address bar: http://www.BkJia.com/index.php. If it works, it means that php and apache can work.

Then, configure Eclipse's PHP development and debugging environment.

1. Install Eclipse. Just unzip it to a directory

2. Install DLTK.

Unzip the downloaded file into 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 unzipped directory and install it

.

3. Install PDT2.0

Root DLTK installation is similar.

4. Install ZDebugger

Unzip the downloaded ZendDebugger-5.2.14RC9-cygwin_nt-i386.zip. There is a readme.txt in the directory. Just install it as mentioned above. The results of executing readme.txt according to the actual situation of my installation are as follows:

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

2) Add:

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 FilesApache Software FoundationApache2.2htdocs

5. Configure Eclipse and Apache

1) Configure Apache:

For example, if I place all Eclipse projects under E:EclipseWorkspace, then modify Apache/conf/httpd.conf and add:

at the end of the file.

Alias ​​/Workspace/ "E:/EclipseWorkspace/"

Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all

The advantage of this is that all PHP projects share an apache configuration (see how to set it up below).

2) Configure Eclipse:

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

PHP Executables->Add, set as follows:

PHP Servers->New, set as follows:

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

PHP Debug, as shown in the figure below, select the appropriate Debugger, Server

At this point, the configuration is complete.

Remember to restart Apache again.

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

Create a new PHP Project and name it FirstPHPTest. Of course, we use our 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, you can see a screen similar to the following:

Just stop here, rest, take a rest


Author sayo.net

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478524.htmlTechArticleFirst prepare the software: 1. Apache, go here to find the latest version 2. PHP, go here to download 3. Eclipse IDE for Java EE Developers, go here to download 4. DLTK Core Frameworks 1.0 Integrat...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn