PHP开发环境配置——Wamp+NetBeans

来源:互联网 发布:淘宝推广多少钱 编辑:程序博客网 时间:2024/06/05 00:57

一、 安装wampserver


运行PHP需要配置Web服务器、数据库等等,在windows下推荐使用wampserver,傻瓜式的一键安装可以快速在windows平台下安装php开始所需环境。

下载地址:http://www.wampserver.com/en/

安装过程十分简单,一路next,本文安装的是2.2版本。


安装好以后启动,单击右下角任务栏的W小图标,点击启动所有服务(Start All Services),图标为绿时表示所有服务已启动。



浏览器中输入localhost(默认配置为80端口),测试确认是否正确安装。


二、配置wampserver的xdebug


在这个版本中xdebug已经包含在wampserver,不需要额外安装,打开php.ini

(位于安装目录\bin\apache\apache2.2.22\bin\php.ini,注意不是bin\php\php5.3.13\php.ini)

在php.ini最后几行可以看见如下配置:

[xdebug]xdebug.remote_enable = off

xdebug.profiler_enable = off

xdebug.profiler_enable_trigger = off

xdebug.profiler_output_name = cachegrind.out.%t.%p

xdebug.profiler_output_dir = "D:/wamp/tmp"

修改为:

[xdebug]

xdebug.remote_enable = on

xdebug.remote_handler=dbgp

xdebug.remote_host=localhost

xdebug.remote_port=9000

xdebug.remote_autostart = 1

xdebug.profiler_enable = off

xdebug.profiler_enable_trigger = off

xdebug.profiler_output_name = cachegrind.out.%t.%p

xdebug.profiler_output_dir = "D:/wamp/tmp"

配置解释:xdebug.remote_enable = on:允许远程调试

xdebug.remote_handler=dbgp:默认调试协议

xdebug.remote_host=localhost:远程服务器IP地址(localhost指的是本机)

xdebug.remote_port=9000:默认端口


保存,重启服务。


三、安装NetBeans


到官网安装NetBeans(官网:https://netbeans.org/)

根据需要选择包含HTML5 & PHP技术支持的版本,本文下载的是7.4版本

安装过程很简单,需要安装java环境,这里就不再详细叙述。


安装好以后需要配置一下调试端口,点击“工具->选项”,选择“调试”选项卡,可以配置调试端口


四、新建PHP项目

点击“文件->新建项目”,

第一步:选择“php项目应用程序”

第二步:输入项目名,位置等等

第三步:运行配置,配置源代码复制到选择wamp下的www文件夹下,如下图


第四步:配置框架,点击完成

编写hello world,点击“运行项目”或者“调试项目”



0 0
原创粉丝点击