When invoked as a CGI binary, PHP refuses to…
…interpret the command line arguments.
What are the following runtime configuration directives: cgi.force_redirect, doc_root, user_dir?
cgi.force_redirect – provides security running PHP as a CGI under most web servers. Left undefined, PHP turns this on by default.
doc_root – PHP’s root directory on the server. Only used if non-empty. If PHP is configured with safe mode, no files outside this directory are served.
user_dir – the base name of a directory used on a user’s home directory for PHP files, for example public_html.
What is –enable-force-cgi-redirect for?
It enables the security check for internal server redirects. You should use this if you are running the CGI version of Apache. As of PHP 5.3, this argument is enabled by default and no longer exists.
What does cgi.force_redirect do?
It’s a configuration directive that prevents anyone from calling PHP directly. Instead, PHP will only parse in this mode if it has gone through a web server redirect rule.
What are three ways to set the PHP script document root?
user_dir expansion happens regardless of the doc_root setting, so you can control the document root and user directory access separately.
What is open_basedir for?
It’s a configuration directive used for limiting the files that can be accessed by PHP to the specified directory-tree, including the file itself. This directive is unaffected by safe mode.
When a script tries to access the filesystem, for example, using include or fopen, the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to access it. All symbolic links are resolved, so it’s not possible to avoid this restriction with a symlink.
What are 6 things you can do to prevent SQL injection?
What would you set error reporting to to test your code?
E_ALL
How can you turn off error displays completely?
Either set error_reporting() to 0, or use display_errors in php.ini. You can also then define the path to your log file using the error_log ini directive, and turn log_errors on.
What is $_REQUEST a mix of?
$_GET, $_POST, and $_COOKIE.
Are magic quotes available in PHP?
Deprecated in 5.3 and removed in 5.4.
What are some ways to hide PHP?