This is an old revision of the document!
uPHP scripts are written by humans as text files (extension .cgi). But to speed things up the Wattmon system actually executes a compiled binary version (extension .cgc), which loads and runs much faster after the first time it is created.
Everytime a uPHP script is run the firmware system automatically checks first to see if there is an available compiled version of the script (it looks in the same directory as the .cgi file for a .cgc file of the same name):
The compiler checks for fatal coding errors, skips/ignores comments and creates a much more compact binary version that will run without all of this additional overhead. As this usually needs to be done only once when the .cgi is first executed, subsequent runs of the same script are much, much faster.
Fatal coding errors will cause the compiler to quit without creating a .cgc file (syntax errors, unknown functions, included files not found, etc.). A System Log entry is created showing the error and line number where compilation failed. The compiler error is also displayed if the script is run from a browser or the telnet console.
Of course, if there are compiling errors the script cannot be executed until the coding error(s) are fixed.
The tools included with the Wattmon OS automatically delete the compiled .cgc file when a .cgi is uploaded or modified, which will trigger compilation the next time the .cgi is run.
To force compilation of a .cgi script simply delete the corresponding .cgc file and the system will compile it again the next time it is run.
There are a few common situations where recompilation needs to be forced by deleting the .cgc file:
In these situations, the system will run an existing .cgc without examining the .cgi file (or included files) for changes, so be sure to delete the corresponding .cgc file at the same time.
include() - Include a file within the current script at the current location