I’ve just added a new project from an existing location in Eclipse Juno, and for some reason it wouldn’t let me create it as a PHP project. Instead, I had to just create it as a general project. Having done this, it is fairly easy to convert it to a PHP Project, by doing the following:
- Open the .project file for the new (non-PHP) project in a text editor
- Open a .project file for an existing PHP project (or, if you haven’t got an existing PHP project, create one in your workspace and use the .project file from that)
- Copy the <buildSpec> and <natures> sections from the PHP .project file (from 2. above) to the .project file for the project that you want to change to a PHP project (from 1. above)
- Save the new modified .project file and refresh the workspace
- The general project should now be a PHP project
The .project file for my PHP projects looks like this:
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>project_name</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.wst.validation.validationbuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.dltk.core.scriptbuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.php.core.PHPNature</nature> </natures> </projectDescription>