encoder-user-guide.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. The ionCube Encoder - Version 1.0.2
  2. -----------------------------------
  3. INTRODUCTION
  4. ------------
  5. The standalone ionCube PHP encoder represents an affordable PHP encoding
  6. solution, and in using the technique of compiled code encoding to not encode
  7. script source, maximises both code protection and run time performance.
  8. With our unique "Hybrid" Loader, users of encoded scripts can run them
  9. either by installing the Loader as a server extension, or with the Loader
  10. installed when needed as a runtime module, requiring no server changes or
  11. even a server restart. Additionally, Loader compatibility with Zend Optimiser
  12. and our popular PHP Accelerator ensures that using encoded files requires
  13. no compromises.
  14. Choosing the ionCube encoder as your encoding solution provides you with
  15. not only a highly sophisticated tool for PHP script protection, but also
  16. ensures that your scripts can be loaded on the widest range of
  17. server configurations.
  18. ENCODER FEATURES
  19. ----------------
  20. This version of the encoder wraps the ionCube PHP Encoding API with a command
  21. line interface, and is designed particularly with website integration and
  22. automation of encoding in mind.
  23. The Encoder and can be used to:
  24. * Syntax check a single file or multiple directories, with easy integration
  25. into emacs/xemacs for instant access to the point of errors
  26. * Encode a single file
  27. * Encode a directory hierarchy
  28. Encoding options support:
  29. * Enabling asp tags (<% %>). Disabled by default.
  30. * Disabling short open tags (<? ?>). Enabled by default.
  31. * Allowing call time references. Disabled by default.
  32. * Generation of encoded files to expire on a given date.
  33. * Generation of encoded files to expire after a time period.
  34. * Restricting encoded files to an IP address or IP address range.
  35. * Verifying that encoded files are PHP readable
  36. * Disabling run-time Loader if not required.
  37. * Normal, faster (2x), or fastest (4x) encoding performance. Ideal for cases
  38. where speed of encoding is more important than speed of loading (uses
  39. different file formats and may offer slightly less optimal runtime
  40. performance).
  41. * Further reducing size of encoded files without impacting load performance.
  42. Directory (project) encoding options allow:
  43. * Including and excluding of files and directories based on name
  44. and/or patterns. Multiple include/exclude statements may be used as
  45. required.
  46. * Using hard links rather than file copying for adding non-encoded files to
  47. the target directory
  48. * Disabling preserving of file times, permissions and ownership. The default
  49. is to preserve file times and permissions on files and directories.
  50. If encoding root, file and directory ownership is also preserved by default,
  51. but can be overridden with different owner/group settings.
  52. * Only adding encoded files to a target directory.
  53. * Erasing, renaming, or merging with a target directory if it already exists.
  54. USING THE ENCODER
  55. -----------------
  56. A list of all command line arguments is given at the end of this user
  57. guide. Running the encoder with -h or --help will also display a summary.
  58. Due to the rich feature set, most options are of the long-format, starting
  59. with -- and having a long name. Options can however be abbreviated to the
  60. shortest string that makes them unique. The encoder will warn if an option is
  61. ambiguous, and not simply use the first matching option that perhaps wasn't
  62. what you intended.
  63. By convention, command options are usually passed before non-option
  64. parameters, but the encoder handles options specified in any position.
  65. You may find it more natural to place the -o option to specify the encoding
  66. target after the source argument, and the encoder supports that. e.g
  67. ioncube_encoder_1.0.2 file.php -o file-encoded.php
  68. The order of options doesn't generally matter, although is important for
  69. --include and --exclude. The order that you specify items to include or
  70. exclude affect which files or directories are actually included.
  71. This is discussed further below.
  72. * SYNTAX CHECKING
  73. To syntax a single file or directory, run the encoder with either -S or
  74. --syntax-check and specify one or more files or directories. By default the
  75. encoder will only show errors (see the section on error reporting for more
  76. details). If --verbose is used then each file checked will be shown even if
  77. no errors are encountered.
  78. The use of the options affecting the PHP language (asp tags, short open
  79. tags, call time references) affect syntax checking, as well as --include and
  80. --exclude determining which files are processed. Running the syntax checker
  81. with --verbose can be a good way to see the effect of using the include and
  82. exclude options.
  83. * ENCODING A FILE
  84. Encoding requires a source and a target, specified with the -o option.
  85. In the simplest form, the usage is:
  86. ioncube_encoder_1.0.2 <source> -o <output>
  87. If encoding a file, simply specify the source file to be encoded and the
  88. output file. Encoding a directory is more detailed.
  89. * ENCODING A DIRECTORY
  90. As an example, let's assume that we wish to encode a directory of files
  91. with path /src/my-project as a directory /encoded/my-project
  92. If /encoded/my-project doesn't exist yet, the encoder can be run as just
  93. ioncube_encoder_1.0.2 /src/my-project -o /encoded/my-project
  94. Other options to affect encoding can be specified as required, and will
  95. encode all files ending with .php or .phtml to the new directory. All
  96. subdirectories in the source hierarchy will be created in the target, and any
  97. non-encoded files will be copied and symbolic links created. The directory
  98. and file times and permissions will also be the same as for /src/my-project.
  99. If running as root, file ownership will also be copied from the /src/my-project
  100. to /encoded/my-project.
  101. If we decide to re-encode, the same command will now give an error as
  102. the target directory already exists. The encoder will not blindly overwrite
  103. a target directory and offers three choices for what it should do in this
  104. case.
  105. --erase will erase the contents of the target directory before encoding.
  106. --rename will rename the target directory as /encoded/my-project.n
  107. Starting from 1, 'n' will be the smallest number that produces a directory
  108. name that doesn't exist.
  109. --merge will preserve the existing target directory, overwriting files that
  110. exist already and creating new ones as necessary. Any files in the target
  111. directory that are not present in the source directory will be preserved.
  112. You must always specify one of the above when encoding to a target that
  113. already exists.
  114. One other restriction that the encoder tries to enforce is that you can not
  115. encode directories that lie within the target tree, and you can not specify
  116. a target directory that is within the source tree.
  117. * Including / Excluding Files
  118. The --include and --exclude options can be used and combined to determine
  119. which files are to be encoded. The wildcard character * may be used to
  120. wildcard part of a filename, and [] may be used to specify a set of characters.
  121. Directories should be specified by appending the name with a /
  122. Examples:
  123. To encode files ending in .inc, in addition to the defaults of .php and .phtml,
  124. use:
  125. --include=*.inc
  126. To not encode files in a config directory (and subdirectories), use:
  127. --exclude=config/
  128. To not encode config files except in config/private/, use:
  129. --exclude=config/ --include=config/private/
  130. As above, but allow help.php in the /config/private directory to not be
  131. encoded, use:
  132. --exclude=config/ --include=config/private/ --exclude=config/private/help.php
  133. * Time Limiting Files
  134. Encoded files can be time limited by either specifying an expiry date or
  135. period.
  136. To specify an absolute date, use:
  137. --expire-on=<yyyy-mm-dd>
  138. e.g. --expire-on=2002-10-01
  139. To specify a period in seconds, minutes, hours or days, use:
  140. --expire-in=<period>
  141. e.g. --expire-in=7d would expire files in 7 days,
  142. --expire-in=8h would expire files in 8 hours
  143. You can use 's', 'm', 'h', and 'd' after a number to denote seconds, minutes,
  144. hours or days.
  145. Note that times are based on UTC. Unix expects that system clocks are set to
  146. UTC, and that a correct setting of timezones is used to offset the clock.
  147. If, however, a user has incorrectly set their system clock then the actual
  148. expiry time may be different.
  149. * IP Limiting Files
  150. Encoded files can be restricted to only load on machines with a specific
  151. address or within a subnet of addresses.
  152. To restrict to a single IP address, use:
  153. --allowed-ip-addr=<a.b.c.d>
  154. e.g. --allowed-ip-addr=192.168.1.12
  155. would restrict files to only that ip address. The ip address is tested
  156. against the ip address reported for the server, and so whilst a machine
  157. may have that address as one of several addresses, the file will only
  158. load if the web server is using that address for the domain being served.
  159. To restrict to a set of hosts, specify a server mask. This uses the same
  160. format as server masks when configuring networks, and specifies which bits
  161. should be tested in the server address.
  162. The mask is specified as
  163. --allowed-ip-mask=<a.b.c.d>
  164. e.g. --allowed-ip-addr=192.168.1.0 --allowed-ip-mask=255.255.255.0
  165. would allow all hosts from 192.168.1.0 to 192.168.1.255 to load the encoded
  166. files but no others.
  167. ERROR REPORTING
  168. ---------------
  169. Syntax errors are reported in emacs/xemacs style format of
  170. filename:line number:message
  171. This offers easy integration with emacs/xemacs and direct access to the point
  172. of error in source files. For example, given a directory of PHP files called
  173. myproject, running the xemacs 'compile' command and specifying the compiler
  174. as:
  175. ioncube_encoder_1.0.2 -S myproject
  176. will syntax check all php files and reports errors in an emacs buffer.
  177. With the default xemacs key bindings, simply hitting ctrl-X ` will run the
  178. 'next-error' function and visit each file with an error and place the cursor
  179. at the line containing the error.
  180. ENCODER PERFORMANCE
  181. -------------------
  182. The encoder is fast, and by default uses an encoding format and performs
  183. an analysis that should yield files that will perform the best at runtime.
  184. However if performance of the encoder itself is critical, or you just can't
  185. wait for your encoded files, specifying --faster or --fastest will speed up the
  186. encoding process. In tests, --faster typically halves the encoding time,
  187. and --fastest halves the time again. These results may depend on the
  188. performance of the server. The 'faster to encode' data formats may sometimes
  189. increase file size although not necessarily.
  190. There is also a --compress option that is often able to reduce the size of
  191. files by a small amount. This step is different to most compression algorithms
  192. in that it does not affect run time performance.
  193. SUMMARY OF ENCODER OPTIONS
  194. --------------------------
  195. Encoding
  196. --------
  197. -o <target file or directory>
  198. Specify the target file or directory.
  199. -S | --syntax-check
  200. Check the syntax of a file or directory. No encoding is performed, but files
  201. are parsed and any errors reported.
  202. --expire-on=<yyyy-mm-dd>
  203. Expire files on the given date.
  204. --expire-in=<period>
  205. Expire files this period after encoding. The period is given
  206. as <number><factor>, where <factor> may be one of h,d,w,m to denote hours,
  207. days, weeks and months. e.g. 'expire-in 7d' means expire in 7 days.
  208. --use-hard-links
  209. When encoding a directory, use hard links to add non-encoded files into the
  210. destination directory structure rather than copying.
  211. --only-include-encoded-files
  212. When encoding a directory hierarchy only include encoded files into the
  213. destination directory structure.
  214. --include=<pattern> | --exclude=<pattern>
  215. Include or exclude files or directories matching <pattern>. Patterns ending
  216. with a trailing '/' match directories. These options may be specified
  217. more than once, and are applied in order when determining whether
  218. or not a file or directory should be included or excluded. The default rules
  219. match all files ending with .php or .phtml in all directories. Excluding
  220. a directory excludes that directory and all subdirectories, although
  221. subdirectories may then be included again with --include.
  222. e.g --exclude=a/ --include=a/b/c would exclude directories, a, a/b, a/d, but
  223. include a/b/c, a/b/c/c1 etc.
  224. --allow-asp-tags
  225. Allow the tags <% and %> to be recognised as delimiters for PHP code.
  226. --no-short-open-tags
  227. Disables the use of <? and ?> to surround PHP code.
  228. --allow-call-time-pass-reference
  229. Allow variables to be passed by reference at the point of making a function
  230. call. Note that this is a deprecated PHP feature, and reference arguments
  231. should instead be specified in the function definition.
  232. --without-runtime-loader-support
  233. Don't generate encoded files capable of installing the Loader at runtime.
  234. By default encoded files are generated that will attempt to find and install
  235. the Loader at runtime if the Loader is not already installed. You may want
  236. to use this option if you know that encoded files will always be used on
  237. a system where the Loader is installed as an extension in php.ini, and files
  238. will be slightly smaller.
  239. --without-keeping-file-perms
  240. Don't apply file permissions from source files to target files.
  241. --without-keeping-file-times
  242. Don't apply file access times from source files to target files.
  243. --without-keeping-file-owner
  244. Don't apply file ownership from source files to target files when
  245. running the encoder as root.
  246. --apply-file-user=<user id/name>
  247. Apply the given file user id or name to target files instead of the
  248. source file user id when running the encoder as root.
  249. --apply-file-group=<group id/name>
  250. Apply the given file group id or name to target files instead of the
  251. source file group id when running the encoder as root.
  252. --rename-target
  253. Rename the target file/directory if it already exists.
  254. --erase-target
  255. Erase the target file/directory if it already exists.
  256. --merge-target
  257. Merge source files into an already existing target directory.
  258. --faster
  259. Use a medium speed encoding technique, may increase loading time.
  260. --fastest
  261. Use the fastest encoding technique, may increase loading time.
  262. --compress
  263. Apply a further analysis stage to possibly reduce file size without increasing
  264. loading time.
  265. --verify
  266. Verify that each encoded file is a valid PHP file and can be read by a PHP
  267. system not running the Loader.
  268. --allowed-ip-addr=<a.b.c.d>
  269. Specify an ip address in dot notation that the encoded scripts are allowed
  270. to run on, e.g. 192.168.1.0 If not specified an encoded script will run
  271. on any ip address. An allowed-ip-mask may also be set to allow
  272. multiple addresses to be matched within a given subnet.
  273. --allowed-ip-mask=<a.b.c.d>
  274. Specify an ip mask in dot notation to permission a group of machines. Defaults
  275. to 255.255.255.255 if an allowed-ip-addr is specified.
  276. e.g. A mask of 255.255.255.0 would and address of 192.168.1.0 would permission
  277. encoded scripts for machines in the group 192.168.1.0 to 192.168.1.255
  278. inclusive.
  279. Miscellaneous
  280. -------------
  281. -v | --verbose
  282. Display information during encoder operations.
  283. -V | --version
  284. Display version information.
  285. -h | --help
  286. Display help.
  287. Copyright (c) 2002 ionCube.com Last revised 16-Sep-2002