Home Backend Development PHP Tutorial Eclipse开发PHP环境配备

Eclipse开发PHP环境配备

Jun 13, 2016 pm 01:16 PM
apache eclipse httpd php

Eclipse开发PHP环境配置

Eclipse开发PHP环境配置

首先准备好软件:

1. Apache,到这里找个最新版本

2. PHP,到这里下载

3. Eclipse IDE for Java EE Developers,到这里下载

4. DLTK Core Frameworks 1.0 Integration build,到这里下载

注意:DLTK是所谓动态语言开发包,PDT依赖于它,不知为什么现在官方主页上的稳定版本从1.0版降到了0.95,而PDT必须在1.0上运行,所以请选择最新的Integration版本(在页面最下面),而不是Release或Stable版本。

5. PDT 2.0,到这里下载

6. Zend Debugger,到这里下载

?

下面开始安装配置这些软件。

首先,安装配置Apache和php环境。

安装不多说,Apache是个msi文件,php只要解压缩就可以了。

配置比较烦,步骤如下:

1. 编辑php.ini

?1) extension_dir = "./"??? 修改为 extension_dir = "C:/php-5.2.6/ext"
?2) ;extension=php_mysql.dll”和“;extension=php_gd2.dll”,去掉前面的分号,即把 ;extension=php_mysql.dll 改为 extension=php_mysql.dll
把 ;extension=php_gd2.dll 改为 extension=php_gd2.dll
?3).保存好php.ini,然后重起apache

2. 修改Apache/conf下的httpd.conf,在文件尾部添加:

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.在环境变量的Path设置下添加:

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

?

经过上述配置,在Apache/htdocs目录下创建一个php测试文件index.php如下:

?

Code

记得重新启动Apache。

打开IE在地址栏输入:http://localhost/index.php,如果能工作就表示php和apache能工作了。

?

然后,配置Eclipse的PHP开发,调试环境。

1. 安装Eclipse.就是解压缩到一个目录

2. 安装DLTK.

把下载到的文件解压缩到某目录下,如:F:"PHP"PDT"dltk-core-I-I200809081043-200809081043- incubation,启动Eclipse->Help->Software Updates->Available Software -> Add Site -> Local -> 选择刚才的解压缩目录,安装之。

3. 安装PDT2.0

根DLTK安装类似。

4. 安装ZDebugger

把下载到的ZendDebugger-5.2.14RC9-cygwin_nt-i386.zip解压缩,目录下有一个readme.txt,按照上面说的安装就行了,根据我安装的实际情况执行readme.txt的结果如下:

1)? 从5_2_x_comp目录下选择ZendDebugger.dll,copy到C:\php-5.2.6\ext下面

2)? 在php.ini文件中添加:

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) 将dummy.php文件copy到C:\Program Files\Apache Software Foundation\Apache2.2\htdocs下面

5. 配置Eclipse及Apache

1) 配置Apache:

比如我在 E:\EclipseWorkspace下放置所有的Eclipse工程,那么修改Apache/conf/httpd.conf,在文件结尾添加:

Alias /Workspace/ "E:/EclipseWorkspace/"

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

这样做的好处是,所有php工程都共享一个apache配置(看下面如何设置)。

2)配置Eclipse:

打开Eclipse->Window->Preferences->PHP:

PHP Executables->Add,如下所示设置:

?

?PHP Servers->New,如下所示设置:

?

?注意URL栏中添加了Workspace,这个是在httpd.conf中添加的目录别名。

PHP Debug,如下图所示,选择合适的Debugger,Server

?

?至此,配置完成。

?记得再次重新启动Apache。

最后,建一个测试程序,看看效果如何:

新建一个PHP Project命名叫FirstPHPTest, 当然使用的是我们的E:\EclipseWorkspace作为Eclipse的workspace目录。

在工程中新建PHP File, 比如使用上面的index.php。

当在index.php上右键 Run As->PHP Web Page时就可以看到类似如下画面了:

?

?

就到这里吧,休息,休息一下。

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP's Purpose: Building Dynamic Websites PHP's Purpose: Building Dynamic Websites Apr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to start apache How to start apache Apr 13, 2025 pm 01:06 PM

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

See all articles