Mac + XAMPP + NetBeans 安装 Xdebug

NetBeans中的PHP项目中,缺省安装后是无法加上断点调试的,需要第三方工具Xdebug的支持。

XAMPP 高版本中带有Xdebug。简单记录下,Mac OSX操作系统上,XAMPP,  NetBeans中安装Xdebug的方法:

测试环境:

  • Mac OSX : 10.9.2
  • XAMPP: 1.8.3-3
  • NetBeans: 8.0

1.  修改XAMPP中的php.ini中文件,加入以下内容:

[xdebug]
zend_extension=/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_mode=”req”
xdebug.remote_log=”/var/log/xdebug.log”
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=”netbeans-xdebug”

2.  重启XAMPP

3.  浏览器中输入 http://localhost/xampp, 查看phpinfo(),  如果有xdebug信息,则表示安装成功

图像

4.  NetBeans中,Web Server 设置为XAMPP环境中建立的localhost.  现在就可以在PHP项目中设置断点,项目右键“Debug”进入调试状态。

备注:

安装xdebug后,运行NetBeans, 就会发现个古怪的现象,XAMPP中显示MySQL Server停运了。但浏览器中查看phpMyAdmin, MySQL还会可以访问。

 

用NetBeans建立WeCenter的开发环境

WeCenter是一款WeCenter 是一款知识型的社交化开源社区程序,专注于企业和行业社区内容的整理、归类、检索和再发行。下载地址:http://www.wecenter.com/downloads/

Web应用开发,涉及到的文件非常多,用IDE开发环境,对集成化调试有帮助,会减轻一些工作量。推荐用开源IDE产品 NetBeans, 最早是用于Java开发的,可安装在Windows, Linux, Mac, Solaris环境下。最近分化出个版本是专门用于PHP和HTML 5的开发。

简要列出用NetBeans建立WeCenter的开发环境的步骤

步骤如下:
1. 下载安装NetBeans , PHP版本, 71M左右 下载地址:https://netbeans.org/downloads/index.html
2. 下载WeCenter,解压,假设解压后目录名为 /Downloads/wecenter
3. 安装LAMP环境, 假设Web Root 目录为 /Applications/XAMPP/htdocs
4. 打开NetBeans, New Projects, 选择“PHP Applications with Existing Soruces”



netbeans_wecenter_1

 

5. 接下来的窗口里, “Source Folder” 选“/Downloads/wecenter/UPLOAD” (参考步骤2)

netbeans_wecenter_2

6. 在接下来的窗口里,如果项目URL是wecenter, 则”Copy Source Folder to Another Location” 选 “/Applications/XAMPP/htdocs/wecenter” (参考步骤3)

netbeans_wecenter_3

7. 至此,完成创建NetBeans中的wecenter项目
8. 在NetBeans中,右键选择wecenter项目,点击“Run”

netbeans_wecenter_4

9. NetBeans会自动在浏览器中打开wecenter项目中设置的首页,如index.php。第一次运行,自动进入wecenter安装, 按照提示一步步完成wecenter安装过程。

netbeans_wecenter_init

10. 正常的就是进入wecenter 首页

netbeans_wecenter_finish

 

之后在NetBeans里,就可以对源代码进行编辑,调试和运行了。

Deploy project on remote Glassfish in NetBeans IDE

At present, NetBeans 5.5.1 doesn’t support remote deployment plug-in,
while we can complete this task through asant in build.xml.
Suppose there are two machines, one is development computer (localhost
machine), the other is the release server, name is sdn.prc.sun.com
Here are the steps.
1. You’d better install Glassfish on localhost and config the project
running on the local Glassfish in NetBeans in order to import the
necessary jar files into the project by default. To use asant, you need
import jar file sun-appserv-ant.jar under lib folder of Glassfish.
2. Create a file containing the remote Glassfish administrator’s
password, the file(eg. passwordfile.txt) has only one line
AS_ADMIN_PASSWORD=adminadmin
3. Modify the build.xml file under the project you create (e.g, the
project name is RemoteDeploy)<project name=”RemoteDeploy” default=”default” basedir=”.”>
<description>Builds, tests, and runs the project
RemoteDeploy.</description>
<import file=”nbproject/build-impl.xml”/>
<target name=”glassfish-remote-deploy” depends=”dist”>
<property name=”admin.password.file”
value=”C:/Sun/AppServer9/passwordfile.txt” />
<sun-appserv-deploy file=”${dist.dir}/${war.ear.name}”
name=”RemoteDeploy”
force=”true”
precompilejsp=”false”
verify=”false”
upload=”true”
user=”admin”
passwordfile=”${admin.password.file}”
host=”sdn.prc.sun.com”
port=”4848″ />

</target>
<target name=”glassfish-remote-undeploy” >
<property name=”admin.password.file”
value=”C:/Sun/AppServer9/passwordfile.txt” />
<sun-appserv-undeploy
name=”RemoteDeploy”
user=”admin”
passwordfile=”${admin.password.file}”
host=”sdn.prc.sun.com”
port=”4848″ />

</target>
</project>

4. Star remote server sdn.prc.sun.com ( administrator user is “admin”,
admin port is “4848”, and admin password is “adminadmin” which was
saved in passwordfile.txt on local machine.
5. Running the “glassfish-remote-deploy” or “glassfish-remote-undeploy”
through ant, you can easilly deploy or undeploy the project RemoteDeploy
on remote server sdn.prc.sun.com.

Change local in NetBeans IDE

My operating platform is Chinese version, while I prefer to user
English version IDE. It’s strange that the menu and label are still
Chinese words even if I downloaded and installed a English version
NetBeans. Java’s i18n is great, so NetBeans can adjust its local
according to Operating Platform by default.
To change the NetBeans local to English version, modify the file
$NETBENA_HOME/etc/netbeans.conf
add “–local en” in “netbeans_default_options”

For example, the original
netbeans_default_options=”-J-Xms32m -J-Xmx128m -J-XX:PermSize=32m
-J-XX:MaxPermSize=160m -J-Xverify:none
-J-Dapple.laf.useScreenMenuBar=true ”
Modified.
netbeans_default_options=”-J-Xms32m -J-Xmx128m -J-XX:PermSize=32m
-J-XX:MaxPermSize=160m -J-Xverify:none
-J-Dapple.laf.useScreenMenuBar=true –locale en

Install Coffee Break application (JAVA EE 5 tutorial case study) on Glassfish V2 through NetBeans 5.5.1

I tried to install the coffee break application in
(javaee-5-doc-tutorial-1.0_02), but met some mistakes. Through testing,
I found there were some tips
1. Make sure that the glassfish is using JDK1.6 (Modify file
sas_install_dir/config/asenv.conf or asenv.bat, set AS_JAVA=), otherwise
some incompatible error will occur when compiling cb_saaj project.
2. The original cb_common source level was set to 1.5, change it to 1.6.
3. When firstly building and deploying cb_jaxws, ignore the error
information.
4. Make sure solving the “web services reference” issue in cb_common
project after deploying cb_jaxws, otherwise, there would be “can not
import com.sun.cb.ws.server …” appearing when building and deploying
cb_saaj project.

Study PetStore 1.4 series (2): Use NetBeans IDE 5.0 to view application server configuration and derby database content.

After deploying PetStore 1.4 on Sun Application Server 8.2 (
j2ee1.4sdk), you can view the source and other content through NetBeans
IDE. I am not used to command line, so GUI is my preferred working style.1. Download NetBeans IDE 5.0 from
http://www.netbeans.info/downloads/download.php?type=5.0
2. Add Sun Application Server in NetBeans IDE. “Runtime (tab) ->
Servers (right click) -> Add server ->. You can see the deployed
petstore applications:
AdminEAR
OrderProcessingCenterEAR
SupplierEAR
PetStoreEAR
3. Create derby connection. Databases -> Apache Derby (Net) (Right
click) -> Connection Using ->
Name: Apache Derby (Net)
Driver: org.apache.derby.jdbc.ClientDriver
jdbc.derby://localhost:1527/derbyDB
User Name: derbypublic
Password: derbypublic
4. Select one table, right click “execute Command…”, you can view the
data through SQL in NetBeans IDE

NetBeans met Eclipse in Sheraton Hotel

In Shenyang’s Sheraton hotel, NetBeans met Eclipse.

We went into Eclipse conference, and listened for a while. I got the conclusion that their promotion were a failure, as the speakers from IBM can only speak English, and most developer in the room have to listen to the translation. The translation was terrible, I don’t understand what they were talking about at all if I only listen to Chinese translation.

Joey Shen, our NetBeans speaker, said he had much confidence to beat Eclipse in this hotel. He attended the IBM’s conference too, and asked a question about Eclipse. The IBM speaker can not gave a satisfying answer, but said that he can gave Joey a gift for such a good question, a wallet with IBM logo. 🙂

White board notice

Add CVS support in NetBeans 5.0

The function can be finished whithin half an hour including installing
CVS server. I tried this in my laptop, Windows XP professional platform
1. Download CVSNT from http://www.march-hare.com/cvspro/
2. Create repository in CVSNT through “CVSNT control panel” after
installation. For example, /cvs/sdndev (e:cvssdndev)
3. In NetBeans 5.0, select the project that will be added into CVS,
click “Import into repository” in “CVS” menu.
4. Use “:local:/cvs/sdndev” as repository name.
5. Then check out, edit, and commite the files.

NetBeans 4.1 IDE, the winner of open source tool of the year 2005

I didn’t try NetBeans before because I don’t have
much confidence in development tools written by Java. When I heard the introduction
of new NetBeans 4.1 in Java China 2005, at first I thought that was just the
company’s promotion behavior.

 

Yesterday, I browsed the CD got from the conference. There
are many interesting content, such as J2EE, J2ME and web services, especially
the Hands-on-Lab. I planed to try those exercises and found that I need to
install NetBeans 4.1.

 

The tour of using NetBeans is wonderful. NetBeans’s performance
and functions exceeded my expectation. The time of starting was a little longer,
but the operation is very fast and I begun to doubt if the product was written
in C. I checked the installation path, and found many jar files which let me
make sure that the excellent product was indeed developed with Java.

 

Besides the improved performance, NetBeans also provides
profound functions. It is open-source based IDE for developing desktop,
enterprise, mobile Java application and Java web services. I decide to use
NetBeans as development tools for my private interests, while at the same time I
will still use Eclipse in my daily work.

 

The biggest winner of developer.com of 2005 is Sun (http://www.developer.com/java/ent/article.php/3483116).
It is a long list of Sun’s product, including J2SE 5.0, J2EE, J2ME
Wireless Toolkit 2.2, Java Web Services Developer Pack, Java Studio Creator,
and NetBeans IDE.