Let's get rid of some interesting content in the PHP. ini file.
The PHP. ini file is believed to be familiar to every PHP enthusiast. it was named PHP3.INI in the previous PHP version PHP3.0. Open it with NOTEPAD. files are usually in the Windows directory of the operating system. As you can see, PHP. the INI file contains many semicolons (""). like Windows systems, these semicolons are used to indicate annotations. that is to say, to make the configuration file clear and easy to understand, the developer gives a brief description of each configuration function after the semicolon, these annotation lines are ignored during system processing. Of course, another benefit is that when the PHP system configuration changes, we can add or remove annotations to or from some rows, which is simple and simple.
.
Auto_prepend_file string can specify that a file is automatically parsed and executed before reading all PHP files. it can be any file such as PHP, ASP, and HTML (but image files may not work ), it is useful in special cases. For example, if you want to add an advertisement on each PHP page, and assume that you are developing a website and want all visitors to perform authentication before reading any PHP page, you can make your verification code a separate file, and set string to the file name here. Careful readers have asked: what if I only need these functions for some files? use your brains. for example:
Myprefix. php file
If (strstr (strtoupper (PHP_SELF), "/PHPTEST /"))
Echo "my ads!
";
?>
In this case, you only need to set auto_prepend_file = "myprefix. php", then all php files under the phptest directory will contain your ad header! It should also be noted that this file should be placed in the path indicated by include_path. otherwise, errors may occur, which will be mentioned below.
Auto_append_file string is similar to the above function, but it is automatically added to the end of the PHP file, and does not work when the PHP program exits with exit. With this function, we can easily add the company address footer!
Include_path string is used to search for files in the PATH defined by the include () and require () functions. Is it a bit like the set path command used in the DOS era? This parameter can provide a list of paths. However, in UNIX, paths are separated by colons. in NT, semicolons are used, and the direction of the slash is also different. For example:
UNIX example: export de_path =.:/home/lib
NT example: include_path = ".: c: homeib" where "." indicates the current directory.
Gpc_order string
GPC is the first letter of the GET, POST, and COOKIE Variables. The order of GPC is the priority level for the system to process the three variables. the priority increases sequentially from left to right. The default value is GPC. when two or three variables with the same name are passed to the server, the system will sort the variables by priority and only read the variables with higher priority. For example, if it is set to "GP", the cookie is ignored and GET is replaced by POST when the access method is the same. Of course, in programming, we should try to avoid passing variables with the same name in different ways at the same time, otherwise the readability of the program will deteriorate, in addition, different output results may occur in different systems.
The magic_quotes_gpc boolean parameter determines the special characters contained in the GET/POST/COOKIE variables: single quotation marks, double quotation marks, and slashes, do you want to add the escape character backslash ("" commonly used in C)? In PHP databases and other systems, single quotes and other characters usually have special meanings. to distinguish them from real characters, we can set magic_quotes_gpc = on, in this way, if the variable we get from the user end contains single quotes, an escape character will be added before it. then we can use the stripslashes (string str) function as needed ); (This function removes the backslash escape character "" from the string. If there are two backslashes in a row, remove one and leave one. If there is only one backslash, remove it directly .) To remove the escape character "", we can compare it:
Echo;
?>
Let's enter single quotation marks and double quotation marks in the text box when magic_quotes_gpc = on and off respectively, and then submit them to see what is the difference?
SMTP string specifies the domain name or IP address of the Mail sending server, so that we can send emails. compared with Microsoft's ASP, PHP is much easier to use. someone may ask, what if I don't have an email server? Simply fill in the email server of the local ISP. In fact, the Mail sending and receiving server is like the post office in our real life. it can be sent at any post office, while the Mail reception is at a fixed post office.
Readers who have used ODBC know that when setting ODBC, you always need to set the database and its default logon username and password. these parameters also mean that they are used in MYSQL. For the sake of security, we also need to limit the user's power in MYSQL. do not be lazy and use "root! If you set these parameters for convenience, you can directly use the mysql_connect () function to connect to the database. Note that no parameters are required here!
You may be thinking, although this is very convenient and dangerous! Don't worry. These parameters are invalid in PHP Security mode. let's take a look at the security mode settings.
Safe mode boolean is not a WINDOWS 98 security mode. When the PHP system is in safe mode, we can control the behavior of PHP programs, at this time, the default database host, user name, password, and other settings of some databases such as MYSQL and INFOMIX are invalid, so illegal users cannot easily connect to the database. In security mode, safe_mode_allowed_env_vars string indicates the type of system environment variables that can be changed by the program, if it is set to safe_mode_allowed_env_vars = PHP _, the system environment variables with only PHP _ headers can be modified. for example, if you use putenv ("windir = UUU") in the program "); to modify the environment variables, the system will prompt a security mode protection error. In addition, the security mode imposes certain restrictions on the system command system (), such as running only in the specified directory, which can protect system files.
The log_errors boolean parameter specifies whether to record the error information in the LOG document when a PHP program fails. In the NT system, if we set error_log = syslog at the same time, we can see the error message of PHP in the application log of the event viewer, this is helpful for testing a large system.
Error_prepend_string = ""
Error_append_string = ""
These two setting parameters are even more interesting. we can see at a glance whether our program has an error! Because his function is to set the error information to a highlighted red color.
As for many other options, some of them can be seen at a glance. if you are interested, try it yourself!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.