| By Ken Fogel | Article Rating: |
|
| June 29, 2009 09:30 AM EDT | Reads: |
2,823 |
An alias file allows the Apache web server to map a URL it receives to a physical location anywhere on the disk rather than in the default document root for the server. We will create an alias called workspace that will point to the root of our workspace.
With a text editor create a text file containing:
Alias /workspace "C:/Users/neon/workspacephp/"
<Directory "C:/Users/neon/workspacephp/">
Options Indexes FollowSymLinks
AllowOverride NONE
Order Deny,Allow
Allow from all
</Directory>
Save it as workspace.conf to the alias folder in the WampServer installation. On my system I saved the file to c:\wamp\alias
You will need to Restart All Services on the Wamp menu and then on the Wamp menu you should see:

Step 8: Install the dummy.php file for testing the Zend PHP debugger
With your text editor create a file containing:
<?php
@ini_set('zend_monitor.enable', 0);
if(@function_exists('output_cache_disable')) {
@output_cache_disable();
}
if(isset($_GET['debugger_connect']) && $_GET['debugger_connect'] == 1) {
if(function_exists('debugger_connect')) {
debugger_connect();
exit();
} else {
echo "No connector is installed.";
}
}
?>
Save it as dummy.php in your Eclipse workspace folder. On my machine that is C:\Users\neon\workspacephp
Step 9: Time to try a php file
Create a new PHP project. Call it FirstPHP and then click on Finish. There is no need to change any settings when creating this first project. I am assuming that you have used Eclipse before.
Select the project in the Project Explorer, right mouse click, and select New PHP file

No need to get fancy, newfile.php is a fine name. Click on Finish. There is an interesting option if you click next concerning templates but you can discover that yourself. The editor now shows:

Replace the text in the editor with the following:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>A test of PHP</p>
<?php
phpinfo()
?>
</body>
</html>
Now save the file.
In the Project Explorer expand the project to show the file. Right click on the file and select Run As -> PHP Web Page

You should now see a dialog that displays the URL to your file.

The http://localhost/workspace will trigger the alias file so that the project folder FirstPHP is used and the file newfile.php is executed.
If all went well you should see the page in Eclipse:

Congratulations! You can run web pages scripted with PHP.
Step 10: The last step is to test the debugger
To test the debugger we need to create a file of a few lines of PHP. Create a new php file in Eclipse called debugtest.php and copy the following into it:
<html>
<head>
<title>Debug PHP Test</title>
</head>
<body>
<p>A test of Debugging in PHP</p>
<?php
$one = 1;
$two = 2;
$answer = $one + $two;
echo "The answer is ", $answer;
?>
</body>
</html>
Run this file as a normal PHP web page as we did for newfile.php to make sure it works.
Now we need to test that the debugger works. Right mouse click on debugtest.php in the Project Explorer and select Run As -> Run Configurations

You should see the Run Configurations dialog. Ensure that debugtest.php is selected and click on Test Debugger

If all has gone well you should see:

Click on OK and then Cancel. We actually do debugging from a different menu item.
Right mouse click on debugtest.php in the Project Explorer and select Debug As -> PHP Web Page.

Accept the request to change perspectives:

You should see:

That's it. Everything works and you are now ready to use Eclipse to write and debug PHP!
A tip of the hat to the following web sites and bloggers who have written about configuring Eclipse for PHP and WampServer:
Published June 29, 2009 Reads 2,823
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Ken Fogel
In 1980 I bought for myself the most wonderful toy of the day, the Apple ][+. Obsession followed quickly and by 1983 I was writing software for small and medium sized businesses in Montreal for both the Apple and the IBM PC under the company name Omnibus Systems. In the evenings I taught continuing education courses that demystified the computer to the first generation of workers who found themselves with their typewriter on the scrap heap and a PC with WordStar taking its place. In 1990 I was invited to join the faculty at Dawson College in the Computer Science Technology program. When I joined the program the primary language was COBOL and my responsibility was to teach small systems languages such as BASIC and C/C++. Today I am now the chairperson and program coordinator of the Computer Science Technology program at Dawson. The program's primary language is Java and the focus is on enterprise programming. I like to write about the every day problems my students and I face in using various languages and platforms to get the job done. And from time to time I stray from the path and write about what I plan to do, what I actually get around to doing, and what I imagine I am doing.
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- Adobe Flex Developer Earns $100K in New York City
- Move Over BI, Here Comes PI - Performance Intelligence
- Yahoo! Query Language
- RothmanResearch.com Market Review and Company Analysis on FULT, DISH, ASBC, CTRP, FSLR and CRBC
- Qt DevDays 2009 - Munich
- The Time Is Right for Enterprise Cloud Computing
- Microsoft Nudges Eclipse Developers to Windows-Ware
- Who Invented Virtualization?
- ExaGrid Sets New Standard in Backup Price, Performance and Capacity with Launch of EX10000E Disk Backup System with Data Deduplication and Expanded 100TB GRID Capacity
- Smearing Cloud Lipstick on a Legacy Tech Pig
- Moving the Operating System & Desktop to the Cloud
- 1st Annual Government IT Conference & Expo: Themes & Topics
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- Is Microsoft as Free as Open Source?
- Adobe Flex Developer Earns $100K in New York City
- The Curious Case of Build Release Management eBook
- IBM, Microsoft, Others in Lock-Picking Cloud API Push
- Move Over BI, Here Comes PI - Performance Intelligence
- United Planet offers practical portal building tips for SMBs
- Yahoo! Query Language
- RothmanResearch.com Market Review and Company Analysis on FULT, DISH, ASBC, CTRP, FSLR and CRBC
- Qt DevDays 2009 - Munich
- The Time Is Right for Enterprise Cloud Computing
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- The Top 250 Players in the Cloud Computing Ecosystem
- Red Hat Named "Platinum Sponsor" of Virtualization Conference & Expo
- Ulitzer to Give Drupal 6.0 Its Biggest Scalability Challenge Yet
- An Introduction to Ant
- Appcelerator Named "Platinum Sponsor" of AJAX World Conference & Expo
- "What's New and Exciting About the Web Right Now?" Asks Time Magazine
- Oracle To Keynote Cloud Computing Expo
- First Eclipse Project Targeting PHP Now Available
- AJAX World - Two Great PDF Creators
- C#, Turbo Pascal, C++, PHP...and the LEGO Brick: Denmark's Leading Exports
- Rolling Your Own MVC: The Page Load Scenario





























