You love coding in Netbeans and you find it pretty uneasy when it does not function the way you want it to. That was the same with me when I started development in drupal and I was unable to associate the .module as PHP in my favorite editor Netbeans.

However with little play around with options I was able to associate .module files as PHP file in Netbeans IDE. So for doing so follow the steps.

  1. Goto Tools –> Options ( or Alt –> t –> O )
  2. Then goto Miscellaneous tab and click on Files sub tab. This is the part of options which handles all the file associations etc.
  3. Now click on New ( Alt + N) , Enter the file extension without . (dot) which you want to associate. In my case I entered “module” and on the second dropdown choose the File type as PHP. ( As shown in the picture below).
  4. Now click OK to save the changes. If necessary close the find and re-open it. If still it doesn’t work, try restarting your IDE.

netbeans_file_association

You can also change the already added file extensions. For instance if you think your PHP file is going to contain more of JS or CSS code then configure Netbeans such that it recognizes JS code in PHP which it won’t be able to recognize by default. To do so, all you have to do is select File Extension as PHP and in File Type change the MIME type to CSS or JS whatever is required. That should do the trick and when you are done, revert back the changes.

Hope that saves your day.

Stay Digified !!
Sachin Khosla

Share this post: