28

I searched a lot, checked many times the neccesary steps, but it still don't work.

My environment is :

  1. Latest eclipse for PHP developer package

  2. Project is newed, not check out directly from SVN

  3. .project has a line

    <nature>org.eclipse.php.core.PHPNature</nature>
    
  4. .buildpath has a line

    <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
    
  5. .settings/org.eclipse.core.resources.prefs has a line

    include_path=0;/projectname
    
  6. file ensured opened in PHP Editor

Something works:

  1. PHP core function defination displayed when mouse over, and Ctrl+Click will open its defined file, but input 'arr' nothing happens, while a list of array functions expected
  2. Autocomplete does work for internal functios/variables such as class members But never works for PHP core functions, neither syntax highlighting
Edward
  • 4,858
  • 9
  • 37
  • 42

8 Answers8

30

Right-Click on your project -> Configure -> Add PHP Support...

Works for me on Eclipse 3.5 / PDT 2.1

Benjamin Cremer
  • 4,842
  • 1
  • 24
  • 30
  • 14
    ever checked this option, it's gray – Edward Aug 19 '09 at 09:52
  • wow thanks, this worked for me on Galileo, it's a pain to work without autocomplete for core features – marioBonales Jan 20 '10 at 17:47
  • 1
    I don't see a 'configure' option when I right-click my project in Helios – Will Sheppard Sep 13 '11 at 08:29
  • Don't forget to add tags too! – csi Jan 02 '13 at 20:16
  • 1
    After you install support for PHP, restarting wasn't enough for me - I had to close any already open files in the editor and then restart and re-open them for the syntax highlighting to work (Eclipse Luna) – decvalts Aug 06 '15 at 07:47
  • Oxygen (Release 4.7.0) doesn't have "add PHP Support" option in the context menu. In my case, editing the [.buildpath](https://stackoverflow.com/a/23788136/1677209) file worked. – T30 Sep 13 '17 at 16:01
22

For me, nothing worked, except:

  1. Backup and then delete the .db files under: /.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/
  2. Restart eclipse.

I got this tip from #4 in: http://www.nwiresoftware.com/blogs/nwire/2010/09/five-tips-speeding-eclipse-pdt-and-nwire

tman
  • 221
  • 2
  • 2
15

As noted before the 'natures' node for php core is listed but this is most insufficient when the project is imported or checked out.

  • Make a backup of your .project
  • Remove the 'natures' node children
  • Close/Re-open eclipse
  • Right-click project -> Configure -> Add PHP Support
  • Add back other 'natures' children

The issue is that project will not make the necessary imports because it assumes it already has.

Patrick
  • 151
  • 1
  • 2
2

Nothing helped, but this:

In Eclipse:

Go to Window -> Preferences -> General -> Editors -> File Associations

Click Add

Type *.php

Under Associated Editors choose PHP Editor and click Default on the right.

Close and open your php file.

Dino Velić
  • 888
  • 11
  • 24
1

There are 3 .dll files: model.h2.db, model.lock.db and model.trace.db under workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2

Remove these files and restart Eclipse.

0

There seem to still be a lot of bugs related to auto-completion for the PHP Development Tools Project (PDT) (See Open Bugs).

One has been entered two days ago: bug 286733 "When using sub namespace completion does not work."

alt text

But this is hardly the only one:

  • "Autocomplete on namespaces failed" (bug 281766)
  • "[php 5.3] Code assist doesn't provide method completion" (bug 286068)
  • ...

They are all related to the namespace of the PHP code. Could you check if you reproduce the error in a global namespace?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • not this one, in my project (no namespace specified), also tried a clean PHP project, autocomplete does work for class members, just no effect when input core functions. – Edward Aug 19 '09 at 00:53
0

If issue is still exists, follow the following steps:

  1. Remove project from eclipse.

  2. Goto your project folder and remove .Settings folder and .project file.

  3. Again import php project with different name.

it's work for me.

yogesh suhagiya
  • 498
  • 2
  • 6
  • 19
0

Right-Click on your project -> Configure -> Convert to PHP Project...

Works for me on Eclipse 4.6 / PDT 5.2

ino
  • 2,345
  • 1
  • 15
  • 27