Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
This weblog a record of the process that I installed and configured PHP Development Tools (PDT) and PHPEclipse. This part has three sections:
# [Installing and Configuring Java on CentOS 5 |#Installing and Configuring Java on CentOS 5]
# [#Installing and Configuring PDT with Zend Debugger server]
# [#Installing and Configuring PHPEclipse with DBG]

The Internet resources that I referenced will be listed at the beginning of each section.

I think it is necessary to list some information of my CentOS 5 system.
{noformat}
Kernel: 			2.6.18-8.1.6.e15
Apache: 			v. 2.2.3
PHP: 				v 5.1.6
Server Document root: 	        /var/www/html
Server URL: 			http://localhost/
{noformat}
I worked as root to test the installation.

h2. Installing and Configuring Java on CentOS 5

Internet resource:
[http://www.java.com/en/download/linux_manual.jsp?locale=en&host=www.java.com]
[http://www.centos.org/modules/newbb/viewtopic.php?topic_id=8390]

Java Runtime Environment (JRE) is required to run Eclipse, because it is written in Java. According to PDT User Guide, "Java 2 (J2RE 1.4.2+) is required to run both Eclipse and PDT".

To check if Java is intalled on CentOS 5,
{code}
[root@centos] java -version
{code}
The following message or similar may be shown:
{noformat}
java version "1.4.2"
gij (GNU liggcj) version 4.1.1 20070107 (Red Hat 4.1.1-52)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
{noformat}
It indicates that Java has been installed on your CentOS 5. However, this version of Java does not work for Eclipse. You will sure get Java errors when you use Eclipse. When you check the error log file (<path to your workspace>/.metadata/.log), you will find the detail information of the error.
!start_up_error_small.jpeg|align=center!\\ {html}
<DIV align="center">Figure 1. Eclipse Starts up Error with GNU Java</DIV>{html}
The reason is that the default Java in CentOS is a GNU version, it is [not a real Java|http://www.zimbra.com/forums/zimbra-desktop/8231-installation-problem-2.html]. Eclipse requires a REAL Java; SUN Java is highly recommended. Fedora 7 comes with 1.5.0 version of GNU Java, and still does not work properly with Eclipse.

First, of course, you need to download SUN Java Run Time (or JDK). I used JRE SE 6.
[http://developers.sun.com/downloads/]

If you are installing from RPM package, then follow the instruction on this page:
[http://java.sun.com/javase/6/webnotes/install/jdk/install-linux.html#install-rpm]

But NOT the instruction on this page:
[http://www.java.com/en/download/help/5000010500.xml#rpm]

Why? Because the later one is NOT correct. The "rpm.bin" file will first create "jre-6<version>-linux-i586.rpm" file, and then AUTOMATICALLY run proper "rpm" command to install JRE. You DO NOT NEED to run
{code}
rpm -iv jre-1_5_0-linux-i586.rpm
{code}
Further, the "rpm.bin" file will install java into "/usr/java" directory, no matter in which directory you run the file (i.e., I run the "rpm.bin" file in /root/Download/ directory).

Lastly, you need to configure SUN Java as the default Java for your system. I recommend to follow the steps provided in [Help with Java installation|http://www.centos.org/modules/newbb/viewtopic.php?topic_id=8390]. This help is in detail and very easy to follow. I will not repeat it here.

h2. Installing and Configuring PDT with Zend Debugger server

Internet resources:
[http://www.thierryb.net/pdtwiki/index.php?title=PDT_User_Guide]
[http://mprobst.de/SherlockWeb/?postid=2]

I was only able to make PDT work properly on CentOS 5 with all-in-one package. Thus, I will only write down the process of installing PDT with all-in-one package. I was able to install PDT successfully with Eclipse SDK3.3 on Fedora 7. The installation process is available [here|Installing PHP Development Tools on Fedora 7].

I used automated installation method to install PDT and Zend Executable Debugger Eclipse Plugin. Following are the steps that I took to install PDT and Zend Debugger server. It has three steps:
# [Download and install all-in-one package|#1. Download and install all-in-one package]
# [Install Zend Executable Debugger Eclipse Plugin |#2. Install Zend Executable Debugger Eclipse Plugin]
# [Install Zend Debugger server| #3. Install Zend Debugger server]

h3. 1. Download and install all-in-one package

The all-in-one package that I used is pdt-all-in-one-S20070611_M1-linux-gtk.tar.gz. Download this file from: [http://europa-mirror1.eclipse.org/tools/pdt/downloads/], and save it in /root/download direcotry; then start a terminal window and do the following (please do not input anything starting from "//" they are just comments I add):
{noformat}
cd /root/download                     //go into the directory where
                                      //the downloaded all-in-one package file is saved.

tar -vxf pdt-all-in-one-S20070611_M1-linux-gtk.tar.gz
//unpack the all-in-one file. "eclipse" directory will be created.

mv eclipse /root/             //move eclipse directory from /root/download/ to /root/.
cd /root/eclipse              //go to eclipse directory
./eclipse &                   //start eclipse program
{noformat}

h3. 2. Install Zend Executable Debugger Eclipse Plugin

With Eclipse window, click "Help->Software Updates->Find and Install...". On the window, click and "Search for new features to install", and then click "next".
!phpide_feature_updates.jpeg|align=center!\\ {html}
<DIV align="center">Figure 2: Feature Updates</DIV>{html}
Click "New Remote Site"; enter "Zend Executable" (or anything you want) in the first text box, and "http://downloads.zend.com/pdt" in the second text box, and click "OK".
!phpide_new_update_site_zend.jpeg|align=center!\\ {html}
<DIV align="center">Figure 3: Add New Update Site - Zend Executable</DIV>{html}
Then, click "Finish" and wait till the following window appears, and click the triangle, and select "Zend Debugger Features" ONLY. DO NOT SELECT "PDT Features"\!\! Click "Next".
!phpide_new_site_zend_only.jpeg|align=center!\\ {html}
<DIV align="center">Figure 4: Select "Zend Debugger Feature" Only</DIV>{html}
On the next window, click "I accept the terms in the licence agreement"; then click "next".
!phpide_zend_license.jpeg|align=center!\\ {html}
<DIV align="center">Figure 5: Accept the License Agreement</DIV>{html}
Next, click "Finish", and then you will see "Update manager" window. Wait till the installation verification window appears and click "Install".
!phpide_zend_installation.jpeg|align=center!\\ {html}
<DIV align="center">Figure 6: Finish Preparing Zend Debugger Features Installation</DIV>{html}
!phpide_zend_update_manager.jpeg|align=center!\\ {html}
<DIV align="center">Figure 7: Update Manager Downloading Zend Debugger Features</DIV>{html}
!phpide_zend_verification.jpeg|align=center!\\ {html}
<DIV align="center">Figure 8: Verify Installation of Zend Debugger Features</DIV>{html}
When the installation is completed, the installation process will ask to restart Eclipse. Click "yes" to restart eclipse.

When Eclipse restarted, you can check if "Zend Executable Debugger Eclipse Plugin" has been properly installed. If everything goes smoothly, you will be able to see Figure 5 in the "[Difficulties in Installing and Configuring PDT and PHPEclipse|My Experiences of Installing PHP IDEs on CentOS#Difficulties in Installing and Configuring PDT and PHPEclipse]" section of My [Experiences of Installing PHP IDEs on CentOS|My Experiences of Installing PHP IDEs on CentOS].

h3. 3. Install Zend Debugger server

The final step is to install Zend Debugger server. This step includes several sub-steps. You need to do the following as root.
1). Create a phpinfo.php file (or what ever name you want to use) with the following code:
{code}
<?php
print_r (phpinfo());
?>
{code}
place it anywhere that you can load it as a web page. I placed it in /var/www/html/.

2). Load the phpinfo.php file in firefox; search for "Extension_dir" text in the web page to find the location of PHP Extension directory. For my CentOS 5, it is /usr/lib/php/modules.
!phpinfo_extension_dir.png|align=center!\\ {html}
<DIV align="center">Figure 9: Location of PHP Extension Directory</DIV>{html}
3). Download Zend Debugger Extension Binary from [Zend downloads|http://downloads.zend.com/pdt/server-debugger/]. I downloaded ZendDebugger-5.2.6-linux-glibc21-i386.tar.gz.

4). Unpack the file and copy the proper "ZendDebugger.so" file to PHP Extension directory.
{noformat}
tar -vxf ZendDebugger-5.2.6-linux-glibc21-i386.tar.gz
//unpack downloaded file. ZendDebugger-5.2.6-linux-glibc21-i386 directory will be created.

cd ZendDebugger-5.2.6-linux-glibc21-i386               //go to the newly created directory

cp ./5_1_x_comp/ZendDebugger.so /usr/lib/php/modules
//copy the right ZendDebugger.so file to PHP extension dircotry. If your have upgraded your PHP to 5.2.x,
//then use the ZendDebugger.so file in 5_2_x_comp directory.
{noformat}
5). Search "Configuration File (php.ini) Path" in phpinfo().php page to find the location of php.ini. Mine is /etc
!phpinfo_php_ini_path.png|align=center!\\ {html}
<DIV align="center">Figure 10: Location of php.ini File</DIV>{html}
Then, open the php.ini file; and search for "implicit_flush", and set it to "On".
{noformat}
; this is to see output while debugging
implicit_flush = On
{noformat}
6). In the php.ini file, search for "output_buffering" and set its value to "0" if it is not.
{noformat}
; this is to see output while debugging
output_buffering = 0
{noformat}
7). Add the following lines in the php.ini file. (I placed them at the end of my php.ini file)
{noformat}
[Zend]
zend_extension=/usr/lib/php/modules/ZendDebugger.so        //full path to your PHP extension directory
zend_debugger.allow_hosts=127.0.0.1/32, 192.168.0.0/16
zend_debugger.expose_remotely=always
{noformat}
8). Disable eAccelerator if it is installed and enabled in the php.ini file.
{noformat}
eaccelerator.enable="0"
{noformat}
9). Copy the file named dummy.php from ZendDebugger-5.2.6-linux-glibc21-i386 directory to the server's document root directory.
{noformat}
cp dummy.php /var/www/html
{noformat}
10). Restart apache server.
{noformat}
httpd -k restart
{noformat}
Now, the installation of PDT is completed. If the installation is successful, then you will be able to see Zend Debugger version information like in Figure 10 in your phpinfo.php webpage after you reload the page.
!phpinfo_with_Zend_Debugger.png|align=center!\\ {html}
<DIV align="center">Figure 11: Zend Debugger Sever is Installed</DIV>{html}
You can write a short PHP code to test if both local debugging and remote debugging work.

h2. Installing and Configuring PHPEclipse with DBG

Internet resources:
[http://docs.schuetzengau-freising.de/modules/xdocman/index.php?doc=xo-002&lang=en]
[http://www.plog4u.org/index.php/Using_PHPEclipse]

I will not talk about installing and configuring PHPEclipse with DBG in detail here for two reasons. First, there are two very good documents about the installation and configuration of PHPEclipse. Second, as I mentioned earlier, I was not able to make PHPEclipse work properly, especially I can not make local debugger work. However, there are something that I think need to address here.

First, unlike the last comment said on [this page|http://vijucat.wordpress.com/2006/03/11/how-i-got-phpeclipse-the-dbg-debugger-working-on-windows/], Eclipse SDK 3.1.2 is actually available at Eclipse website. Following is the URL where you can find Eclipse SDK 3.1.2.
[http://archive.eclipse.org/eclipse/downloads/drops/R-3.1.2-200601181600/index.php]

Second, I only made Eclipse SDK 3.1.2 + PHPEclips 1.1.8 work for remote debugging. However, in fact, I was even unable to make remote debugging work at first. I searched Internet and found this [How I got PHPEclipse + the DBG debugger working on Windows|http://vijucat.wordpress.com/2006/03/11/how-i-got-phpeclipse-the-dbg-debugger-working-on-windows/] page. Then I changed the content of {html}[debugger]{html}entry of my php.ini file to the following to make remote debugging work. Here is my {html}[debugger]{html}entry: \\
{noformat}
[debugger]
extension=dbg.so
debugger.enabled=on
debugger.profile_enabled=on
debugger.hosts_allow=localhost
debugger.ports=7869, 10000/16
debugger.JIT_host=clienthost
debugger.JIT_port=7869
;debugger.JIT_enabled=on      //This line does not affect debugging!
{noformat}
Third, I think PHPEclipse is not convenient to use in terms of remote debugging, because you have to start debugging process in PHPEclipse environment first; then switch to your web browser and entering an URL that looks like the following:
{noformat}
http://localhost/eclipse/Test/DebugTest.php?DBGSESSID=1@localhost:10001
{noformat}
and then switch back to PHPEclipse environment again.

Last comment:
From these years' experiences of using Linux and Windows, I have to admit that installing and configuring software in Linux is really more difficult than in Windows. :-(