Now, as we have created a PHP project we need some PHP files in it. The following sections will explain the different aspects about adding a file to your project.
Per se, there are two different methods of adding a file to your project. Both are available through the “File” menu.
The first method is to add a “simple” file to your project by clicking on ->-> (see Figure 3.5, “Adding a simple file to the project”). This will open the appropriate “New File” dialog. Input the name for that file (with the extension “php”), and click on . This will add the new file to the “Navigator” pane, and opens an editor view.
The second method of adding a PHP file to your project is through ->-> (see Figure 3.9, “Adding a PHP file to the project”). This will open a “New PHP file” dialog with a default File name entry of “file.php” (see Figure 3.10, “The New PHP filedialog”). We change the file name to mySecondFile.php (see Figure 3.11, “Change the name to what you like”) and click on .
This also will add a PHP file to your project as you can see in the Navigator view (see Figure 3.12, “The new PHP file in the Navigator View”), and it also opens this new file within the PHP editor (see Figure 3.12, “The new PHP file in the Navigator View”) as it was done in Section 3.2.1, “Adding a simple file”.
But there is obviously a difference. In opposite to myFirstFile.php which is a real empty file, mySecondFile.php has some text in it (see Figure 3.13, “The new PHP file opened in PHP editor”). The file we just created is filled with a “template”.
The difference is only at creation time. The files themselfs, when created, do not differ in any sense.
When we look at file system level, the absolute path of the files we just created are in respect of the current workspace, in general: workspace_path/project/file.php. For example if you have accepted the default workspace when you started eclipse (and your username is Robert):
myFirstFile.php: C:/Dokuments and Settings/Robert/workspace/MyFirstPHPProject/myFirstFile.php
mySecondFile.php: C:/Dokuments and Settings/Robert/workspace/MyFirstPHPProject/mySecondFile.php
![]() | Note |
|---|---|
The importance of knowing the absolute path is when the web server comes into account. As you want to test the program you have written, the web server needs access to your PHP files. This could be accomplished either when you set your web server's document root to point at your current workspace, or set your workspace to the currect web server's document root. But there is a third way, which will make things easier, as you can leave the workspace wherever you want, and also do not need to change the web server's document root. | |
There are generally two ways to add files, which already exists anywhere on your file system, to a project[2].
You can import files from anywhere on your local machine by eclipse itself via -> (see Figure 3.14, “Import Files into Project”) or by manually copying the files via the file system into your project folder (see Section 3.2.2, “Add a PHP file to the project”). In fact the way via Import... is more convenient.
But this method only makes a copy of existing files, and doesn't disburden you from changing the web server's “document root”. Especially if the files you have currently imported to your workspace are located on your current web server's “document root”.
In this case it would be easier to set the workspace to the current web server's “document root”, or do as described in the following section Section 3.2.3.2, “Link Folders”.
Indeed, this should be the best option if you want to have independence between a eclipse workspace and the web server's “document root”.
Create a new project (e.g. “MyLinkedPHPProject”).
Right click on this project within the “Navigator View” to open the context menu and click on. -> (see Figure 3.15, “Add a Folder to Project”).
Click on and enable (see Figure 3.16, “Create a Link Folder”).
Now you can either manually enter the path or browse to the folder which is to link. In the example we input C:\Program Files\apachefriends\xampp\htdocs, and click on . The “Navigator View” should now look like (see Figure 3.17, “The Navigator View with the new Project”).
At last we have to set the correct “document root” (which is C:\Program Files\apachefriends\xampp\htdocs) within the project properties as shown in Figure 3.18, “Change the Project's DocumentRoot Setting”
| Author | Thread |
|---|---|
| dalong | Published: 2006/11/16 8:00 Updated: 2006/11/16 8:00 |
|
Just popping in
Joined: 2006/11/16
From:
Comments: 2
|
very good!
I like here! ![]() |
|
|
|
| Author | Thread |
|---|---|
| Mark_1900 | Published: 2006/11/18 11:05 Updated: 2006/11/18 11:09 |
|
Just popping in
Joined: 2006/11/18
From:
Comments: 2
|
For an Alias I also had to add a Directory tag to the httpd.conf, otherwise I had permission problems accessing the files...
<br />
[code]
Alias /wiki "C:/Documents and Settings/Me/wiki"<br />
<Directory "C:/Documents and Settings/Me/wiki"><br />
Options Indexes MultiViews<br />
AllowOverride None<br />
Order allow,deny<br />
Allow from all<br />
</Directory><br />
[/code]<br />
Oh and all these editing tags seem broken!!
![]() |
| Author | Thread |
|---|---|
| Mark_1900 | Published: 2006/11/18 11:21 Updated: 2006/11/18 11:32 |
|
Just popping in
Joined: 2006/11/18
From:
Comments: 2
|
I want a debugger. I downloaded the latest XAMPP 1.5.4a and noticed that it comes with PHP 5.1.6 & PHP 4.4.4, and neither are supported. The debugger module only supports a subset of these major versions from 5.1.0 to 5.1.2 and 4.4.0 to 4.4.2 (http://dd.cron.ru/dbg/downloads.php). I think right at the beginning you should specify which versions to download to get a debugger Version "XAMPP 1.5.2" would be fine.
|
| Author | Thread |
|---|---|
| huqilong | Published: 2006/11/30 6:28 Updated: 2006/11/30 6:28 |
|
Just popping in
Joined: 2006/11/16
From:
Comments: 3
|
I want to know how to use phpeclipse with eclipse detailly!
|
| Author | Thread |
|---|---|
| thierrybo | Published: 2007/2/3 16:19 Updated: 2007/2/3 16:21 |
|
Just popping in
Joined: 2007/2/3
From:
Comments: 1
|
I do not agree with the suggested method 2:
Quote:
For example you have set up XAMPP and your “document root†path is the XAMPP default:
C:Program Filesapachefriendsxampphtdocs
,then your appropriate workspace path should be one level less:
C:Program Filesapachefriendsxampp
|
| Author | Thread |
|---|---|
| dafydd | Published: 2007/4/3 6:01 Updated: 2007/4/3 6:01 |
|
Just popping in
Joined: 2007/4/3
From:
Comments: 2
|
Trying this out on a Mac. J2SE 1.5.0_07-164 installed. 1.5.0_06 is what's available on the download site. However, it would almost certainly be updated with Software Update.
|
| Author | Thread |
|---|---|
| dafydd | Published: 2007/4/6 1:00 Updated: 2007/4/6 1:00 |
|
Just popping in
Joined: 2007/4/3
From:
Comments: 2
|
Second question: How do we point the XAMPP start/stop buttons in the Eclipse toobar to where we put XAMPP?
dafydd |
| Author | Thread |
|---|---|
| dysmas | Published: 2007/8/4 14:18 Updated: 2007/8/4 14:18 |
|
Just popping in
Joined: 2007/8/4
From:
Comments: 1
|
Thanks hundred times for all the detailed explanations here !!
And especially for the note which explains why debugging a CLI application does not work in 1.1.8 version and only in 1.1.9. (wrong port, as I guessed, but I have been looking for this information for some hours before coming here). Unfortunately this 1.1.9 CVS version does not work in the last 3.2.0 Eclipse version I just got. Let us hope the stable version is going quickly. |
| Author | Thread |
|---|---|
| Mercyful | Published: 2007/9/10 14:46 Updated: 2007/9/10 14:46 |
|
Just popping in
Joined: 2007/9/10
From:
Comments: 1
|
I want using eclipse3.2 with php-plugin and for debugging i want using dbg.
I'm using xampp 1.6.3a with php 4.4.7. and php_dbg.dll-4.4.x After step by step installation http://docs.schuetzengau-freising.de/ ... =xo-002&file=ch01s05.html the debugger dbg will not work. When i called phpinfo() there is no section dbg shown. Who have any ideas? Thanks a lot! Regards Mercyful |
| Author | Thread |
|---|---|
| keryx | Published: 2007/9/26 22:59 Updated: 2007/9/26 22:59 |
|
Just popping in
Joined: 2007/9/26
From:
Comments: 1
|
A section about verrors should be nice. I get the following:
<terminated, exit value: 0>PHP C:\Program\PHP\php.exe : <path>/<fil>.php I've googled like crazy but to no avail. And yes - it does not stop at breakpoints and "variables" are empty. DBG is working: if (function_exists ("DebugBreak")) { DebugBreak (); echo "debugging started!<br />\n"; } Outputs "debugging started!" And DBG is reported on phpinfo(). |
| Author | Thread |
|---|---|
| koski | Published: 2007/10/19 3:55 Updated: 2007/10/19 3:55 |
|
Just popping in
Joined: 2007/10/19
From:
Comments: 1
|
Hi,
Seems that the mentioned link for cvs: http://phpeclipse.sourceforge.net/update/cvs is out of date or wrong. |
| Author | Thread |
|---|---|
| andybruk | Published: 2007/11/18 1:11 Updated: 2007/11/18 1:11 |
|
Just popping in
Joined: 2007/11/18
From:
Comments: 1
|
I've been searching for a PHP debugger for ages. This is the only one I can find that works perfectly, thanks very much for providing this documentation.<br /><br />I doubt if I could ever get it to work on Windows, but it works so well with Ubuntu Linux and Eclipse 3.1.<br />
|










![[Note]](docs/en/xo-002/img/admon/note.png)











