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 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.
I worked as root to test the installation.
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,
The following message or similar may be shown:
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.
<DIV align="center">Figure 1. Eclipse Starts up Error with GNU Java</DIV>
The reason is that the default Java in CentOS is a GNU version, it is not a real Java. 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.
If you are installing from RPM package, then follow the instruction on this page:
But NOT the instruction on this page:
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
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. This help is in detail and very easy to follow. I will not repeat it here.
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.
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
- Install Zend Executable Debugger Eclipse Plugin
- Install Zend Debugger server
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):
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".
<DIV align="center">Figure 2: Feature Updates</DIV>
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".
<DIV align="center">Figure 3: Add New Update Site - Zend Executable</DIV>
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".
<DIV align="center">Figure 4: Select "Zend Debugger Feature" Only</DIV>
On the next window, click "I accept the terms in the licence agreement"; then click "next".
<DIV align="center">Figure 5: Accept the License Agreement</DIV>
Next, click "Finish", and then you will see "Update manager" window. Wait till the installation verification window appears and click "Install".
<DIV align="center">Figure 6: Finish Preparing Zend Debugger Features Installation</DIV>
<DIV align="center">Figure 7: Update Manager Downloading Zend Debugger Features</DIV>
<DIV align="center">Figure 8: Verify Installation of Zend Debugger Features</DIV>
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" section of My Experiences of Installing PHP IDEs on CentOS.
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:
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.
<DIV align="center">Figure 9: Location of PHP Extension Directory</DIV>
3). Download Zend Debugger Extension Binary from Zend downloads. 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.
5). Search "Configuration File (php.ini) Path" in phpinfo().php page to find the location of php.ini. Mine is /etc
<DIV align="center">Figure 10: Location of php.ini File</DIV>
Then, open the php.ini file; and search for "implicit_flush", and set it to "On".
6). In the php.ini file, search for "output_buffering" and set its value to "0" if it is not.
7). Add the following lines in the php.ini file. (I placed them at the end of my php.ini file)
8). Disable eAccelerator if it is installed and enabled in the php.ini file.
9). Copy the file named dummy.php from ZendDebugger-5.2.6-linux-glibc21-i386 directory to the server's document root directory.
10). Restart apache server.
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.
<DIV align="center">Figure 11: Zend Debugger Sever is Installed</DIV>
You can write a short PHP code to test if both local debugging and remote debugging work.
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, Eclipse SDK 3.1.2 is actually available at Eclipse website. Following is the URL where you can find Eclipse SDK 3.1.2.
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 page. Then I changed the content of
entry of my php.ini file to the following to make remote debugging work. Here is my
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:
and then switch back to PHPEclipse environment again.
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.