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

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

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

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

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

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.
