Syntax highlighting PHP shell scripts without extension in netbeans

I have several shell scripts - written in PHP - as part of a project. None of these files have a file extension and cannot be added due to limitations caused by outdated code. There is currently no way in Netbeans to identify these scripts as PHP, and therefore use the syntax highlighting of other PHP scripts. Common methods in different editors that allow shell scripts to use syntax highlighting are things like modellers in Vim ( other examples here ), but as far as I can tell, there is nothing like this in Netbeans. Each file has shebang and php tags that identify scripts as php files. Does anyone know a workaround for this? I want to add content to files to make this work, but for a number of reasons I cannot add the extension.

FWIW I am using the PHP version of netbeans 6.9.1 with the C / C ++ plugin to enable syntax highlighting of .sh files

+4
source share
2 answers

I executed it by right-clicking the file and selecting the option "Open as ...". In the dialog box, select the "text / x-php5" option and click the "Open" button.

Interestingly, when I go to Tools> Options, Miscellaneous, Files tab, I don’t see a way to delete or change associations created for files without extensions.

After an additional search, I found a file containing definitions. In Windows XP, it can be found here:
[%HOMEDRIVE%%HOMEPATH%]\.netbeans\6.9\config\Services\MIMEResolver\user-defined-mime-resolver.xml

My file is as follows:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.1//EN" "http://www.netbeans.org/dtds/mime-resolver-1_1.dtd"> <MIME-resolver> <file> <ext name=""/> <resolver mime="text/x-php5"/> </file> </MIME-resolver> 
+10
source

Do files have a .php extension? Syntax highlighting should be automatic if you are using a version of PHP. (By the way, the PHP version is just the kernel with the PHP extensions installed.)

-1
source

All Articles