Sunteți pe pagina 1din 21

< PHP Bogus Bug | Main Java & Gang | PHP Eclipse PDT and Wordpress >

INSTALL AND USE ECLIPSE PHP DEVELOPMENT TOOL (PDT)


In this track we will try to run Eclipse PHP Development Tool (PDT) and then use this tool to test a simple PHP code. Pre requirements: 1. JRE (or JDK) already installed. 2. Apache already installed and working. 3. PHP engine (for parsing) already install and works. The machine specifications used in this task are: a. b. c. d. e. f. Intel Pentium Core 2 Duo, 2.2 GHz, Windows XP Pro SP2 + periodical patches + periodical updates 2 GB DDR2 RAM 160 GB SATA HDD 17 SyncMaster 713N monitor. PHP 5.3.2 for Windows

1. Download latest version of PDT from Eclipse website.

2. We extract all the files to C drive and leaving the folder name to default.

3. Under the pdt-all-in-one-S20071213_M1-win32 folder and there will be eclipse sub folder.

4. Open the eclipse folder and double click/launch eclipse.exe. You may want to create a short cut on your desktop.

5. You will be greeted by the following nice flash screen.

6. Setting your workspace. In this case we already set the Apache web document root so to make Apache run our PHP project or files, we need to put our PHP workspace under the Apache web document root. Otherwise we need to setup web server manually to test our PHP project.

7. Click Browse and find the Apache web document root.

8. Depending on your Apache web document root location, set in the httpd.conf file, change accordingly. You may want to set this workspace as the default by ticking the tick box below the Workspace: field shown below. Click OK when finish.

9. Next, the Eclipse Platform launched.

10. Then, we need to set the perspective for PHP. Click Window > Open Perspective > PHP.

11. The PHP development environment launched as shown in the following snapshot.

12. Next, let try a very simple PHP project, that display the PHP information using the phpinfo() function. Click New > PHP Project.

13. Fill in the project name for example in this case, testphp, tick the Enable project specific settings (only the different version of PHPs). The project contents default to the testphp that created under the Apache web document root folder. Click the Configure Workspace Settings link.

14. Only two settings available: choosing the PHP version and treating ASP tags as PHP tags. We just select the PHP version 5. Click OK and then click Next.

15. Just click Finish, nothing need to be set here.

16. Next, we add PHP file. Select and right click the project node > New > PHP file.

17. Put the PHP file name. In this case testphpinfo. Click Next.

We will use a very simple PHP template. Click the PHP template link.

18. There are many PHP templates that you can choose. Click OK.

19. Now, type (or copy and paste) the following phpinfo() function inside the PHP tag. // Show all information, defaults to INFO_ALL phpinfo();

20. Let run our PHP project in debug mode. Click Run > Open Run Dialog.

21. If you encounter the following Windows firewall alert, unblock it.

22. Select and right click the PHP Web Page node > New.

23. A new configuration page displayed. Click the Browse button on the right of the File field.

24. Select the PHP file as shown below. We only have one PHP file. Click OK.

25. Next, click the Configure button.

26. The http://localhost already OK for our case. Click the Path Mapping tab.

27. Click the Add button. We need to map the path on server to the local path.

28. Put the C:\Apache Software Foundation\Apache2.2\htdocs\testphp in the path on Server: field. Click the browse button.

29. Select the project folder and click OK.

30. Our path mapping is shown in the following Figure. Click OK.

31. Next, we need to edit the URL field. De-select the Auto Generate. Point to the file name (because we do not use index.* as the file name) as shown below (/testphp/testphpinfo.php). Click the Apply button.

--------------------------------------------------------------------------------------------------------------------

32. Explore the Advanced tab. Nothing has been changed here, select Open in Browser if it is not selected. Click the Common tab.

33. Select the Debug and Run tick boxes and dont forget to rename this config file to testphp_config so that we can create another configuration for other web application testing later. Click the Apply button.

34. Next, click the Run button.

35. Well our PHP project has been run and the output shown in the IE browser shown below.

36. If you want to test on other browser, click Window > Web Browser > select your_selected_web _b rowser. In this case we change to Firefox.

37. Re-run your project.

< PHP Bogus Bug | Main Java & Gang | PHP Eclipse PDT and Wordpress >

S-ar putea să vă placă și