Eclipse开发PHP环境配置
首先准备好软件: 1. Apache,到这里找个最新版本 2. PHP,到这里下载 3. Eclipse IDE for Java EE Developers,到这里下载 4. DLTK Core Frameworks 1.0 Integration build,到这里下载 注意:DLTK是所谓动态语言开发包,PDT依赖于它,不知为什么现在官方主
首先准备好软件:
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如下:
php
phpinfo();
?>
记得重新启动Apache。
打开IE在地址栏输入:http://www.2cto.com /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时就可以看到类似如下画面了:
就到这里吧,休息,休息一下

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.
