Entry
Can I hide my PHP code?
Jun 1st, 2002 22:23
Sergey Repetov, Tobias Sasse, Philip Olson, Nathan Wallace, Chung Shell,
PHP code cannot be seen by the client browser.
You can make your PHP code available for viewing in the browser by
setting up your web server to return PHP files without executing them,
or by setting up the source viewing options.
When you call the page it is processed on the server and ONLY HTML code
is returned.
Since PHP is interpreted at run time, people who have access to the
webserver can see the PHP code by looking at the files.
An example :
common.inc // code is visable via the web (BAD)
common.inc.php // code is not visable via the web (GOOD)
Do don't include .inc files, make them .inc.php instead (or whatever
your web server is setup to parse as php , perhaps .phtml , .php3 ...)
regarding the hiding of your includes, check this out :
http://www.phpbuilder.com/tips/item.php?id=66
Ideally your includes will be outside of the doc root. Pay special
attention to the user comments within the above link for various
options.
Now if you are wanting to totally hide the source ("compile") you
can do this. Zend developed an encoder, information on it can be
found here :
http://zend.com/store/products/zend-encoder.php
Alos you can use PHTML Encoder at http://www.rssoftlab.com
This is freeware for Windows, commercial under UNIX.
Trial version for Linux available.