Introduction: This is a detailed page for PHP. ini configuration file roaming. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 323153 'rolling = 'no'>
PHP configuration file
Before browsing the PHP configuration file, it is worth noting that the internal structure of the PHP configuration file is structured. This file is called PHP. ini. It is used with many Windows applications.ProgramIfiles that are widely used have the same structure. PHP. INI is an ascll text file, which is divided into multiple parts, each part includes related parameters, as shown below:
[Mysection]
Variable = "value"
Anothervariable = "anothervalue
The name of each part is placed in square brackets at the beginning, followed by the name pair number, each name pair occupies a separate line. Because PHP rules are usedCodeThe parameter name is very sensitive and cannot contain spaces. However, the parameter value can be a number, string, or Boolean logical number.
The semicolon is at the beginning of each row and serves as the specified tag. This makes it easy to use or avoid using these features of PHP, without deleting the row. You can annotate it, so that this row will not be compiled. If you want to use this feature again in the database in the future, it is very convenient and you do not need to delete it from the file.
For PHP recognition. the INI file must be placed in the current directory, which is defined in the $ phprc environment parameter or the directory specified during the compilation time (for Windows PHP, it is the first Windows directory ).
After changing the PHP format through the php. ini file, you will need to restart the Web server to make your change take effect (of course, this is assumed that you are using PHP through the Web server ). For PHP command lines, the configuration file is read once every time a PHP binary program is imported.
Set parser options
In this process, the first step is the most important step, that is, the options related to the language interpreter. The first option here is the engine parameter, which controls the PHP server to "on" or "Off ". If the server is disabled, the embedded PHP code will not be parsed by the Web server. However, the server is usually "on.
Engine = on
Short_open_tagDoes the parameter control grammar analyzer recognize shortcuts <?...?>, Similar to the identification standard key <? PHP...?>. If this parameter conflicts with other languages, or you want to use strict syntax rules in PHP code, disable this parameter.
Short_open_tag = on
Generally, cookie or HTTP data must be sent before any program generates output. If you cannot implement this in a program, you can use the output_buffering parameter to make the PHP call to the output buffer take effect.
When the output buffer is in the "on" status, PHP stores the program output in a dedicated memory buffer and sends the data within a specified time range. This allows you to send special hiip titles and important data during the programming process or when it is about to end. However, it also reduces some important functions.
Output_buffering = off
You can also specify the buffer size through the output_buffering parameter value, for example:
Output_buffering = 2048
When PHP is started, it adds information about the version number to the standard title box of the Web server. To disable this feature, set expose_php to false. This is very useful. For example, you can prevent hackers from hiding your webpage server capacity.
Expose_php = on
Now let's take a look at how to set the search path and capture errors.
Set PHP search path
You can use the include_path parameter to set the PHP search path, which can receive directories of the series. When PHP encounters a file prompt with no path, it will automatically detect these directories.
If you frequently use function libraries or classes, you can list their current locations to simplify file search. This is also a good way to add paths to the pear directory of PHP. The pear directory contains many reusable classes.
Export de_path = ".:/usr/local/lib/PHP/pear :"
Window users can use semicolons to specify multiple locations, while Unix users must be separated by colons.
The best two parameters for this section are auto_prepend_file and auto_append_file. These Parameters specify some files that automatically set the search path for the data files when PHP starts and ends. This feature is mostly used to set the title and the search path of the page in PHP running, which allows you to save several lines of code in each PHP file. However, the specified file will be added to the * All * PHP document. Therefore, these parameters are best suited to the server of a single program.
These files can be PHP programs or HTML files. The embedded PHP code must use the standard <? PHP ...? Tags include:
Auto_prepend_file =/home/web/uplodes/header. php
Auto_append_file =/home/web/uplodes/legal. php
Capture Error
PHP errors are divided into four types: analysis errors, code error notifications (such as non-initialization parameters), warnings (not very serious errors), and severe errors. In general, PHP displays an error when it encounters an analysis error, a common error, or a very fatal error. If the error is very serious, it may stop processing the program. You can use the error_reporting parameter to change this feature. This parameter can identify some error code and display the program code corresponding to the error.
Error_reporting = e_all
To disable error display, set display_errors to false. Conversely, you can set the log_errors parameter to write error messages to error logs.
From the security perspective, disabling error display is advantageous. Hiding detailed information of the system prevents malicious users from opening and destroying your web pages or programs. You should specify a file name for these errors by setting the error_log parameter and write the errors in a custom log file or by specifying the specific parameter "syslog. Remember, you should check these log files regularly to view the changes in the log files.
Display_errors = off
Log_errors = on
Error_log = "error. log"
In this articleArticleIn the second part, I will go further to PhP. the INI file discusses the following settings, including: File Upload, table parsing, running PHP in restricted mode for better security, stimulating scalability, and setting the memory usage of resources, and make some features ineffective to improve performance.
The first part of this article has introduced the structure of the php. ini file and explained how to modify the PHP search path, handle errors, and related options of the parser. The second part will go deep into the configuration file, including how to activate PHP extension options, set resource limits for PHP scripts, and dynamically change configuration variables through PHP scripts.
More articles on "php. ini configuration file roaming"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/323153.html pageno: 16.