Syntax highlighting .html files as php in Eclipse

I keep forgetting how to do this so writing this down so I can refer to it later

I want .html to have the .php syntax highlighting as some we get .html to parse as .php. By default Eclipse doesn’t do this which is a right pain.

  1. Go to Window > Preferences
  2. In Preferences, go to General > Content Types
  3. Select PHP Source File and add *.html as a file association
  4. Click on File Associations link or General > Editors > File Associations
  5. Select *.html and add the PHP Editor as an associated editor - make it the default
  6. Next time you open a .html file with php tags, it’ll be highlighted as a php file! yay!

Comments are closed.