Normally in public_html
Normally named like:
File contains normal HTML, and PHP code mixed in, delimited as follows:
more html code
PHP gets interpreted on server side before resulting HTML stream is returned to client.
Whatever the PHP writes to
standard output (stdout)
appears in the browser.
Client can't see PHP code:
PHP used for interaction with databases/files on server.
- PHP demo
- Return a single environment variable:
- Debugging can be difficult.
- The issue:
- If PHP writes error messages to stdout (to web page), hackers can use this to experiment, and test for server-side vulnerabilities.
- So servers often turn off PHP error output.
- Over-ride server defaults: Turn on error output for your own PHP. Include these lines:
and then error messages are displayed.
ini_set ( 'display_errors', true );
ini_set ( 'display_startup_errors', true );
error_reporting ( E_ALL );
- Comment/uncomment this block.
- You can dump variables to stdout:
print "x is $x";
- To display full structure of a complex object: