Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of php.ini configuration File

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article shares with you the content of a sample analysis of php.ini configuration files. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

[PHP]

PHP is also an evolving tool, and its functions are still being deleted.

The setting changes of php.ini can reflect considerable changes.

Before using the new version of PHP, it would be beneficial to study php.ini

About this document

This file controls the views of many aspects of PHP. In order for PHP to read this file, it must be named

; 'php.ini'. PHP will look for the file in turn in these places: the current working directory; and the environment variable PHPRC

; the specified path; the path specified at compile time

Under windows, the compile-time path is the Windows installation directory.

In command-line mode, the lookup path for php.ini can be replaced with the-c parameter.

The syntax of this file is very simple. White space characters and lines starting with the semicolon'; 'are simply ignored (just like you might

; guess the same). Chapter titles (for example: [Foo]) are also simply ignored, even if they may be in the future

It has a certain meaning.

Indicates that the following syntax is specified:

; indicates identifier = value

; directive = value

Indicates that the identifier is * case-sensitive *-foo=bar is different from FOO = bar.

; value can be a string, a number, a PHP constant (such as: E_ALL or M_PI), the

; a (On, Off, True, False, Yes, No and None), or an expression

; (for example: E_ALL & ~ E_NOTICE), or a string enclosed in quotation marks ("foo").

Expressions in INI files are limited to bit operators and parentheses

| | bitwise OR |

; & bitwise AND

; ~ bitwise NOT

;! Boolean NOT

The Boolean flag can be left on with the values 1, On, True or Yes.

; they can be set to the off state with the values of 0, Off, and False or No.

An empty string can be expressed without writing anything after the equal sign, or with the None keyword:

; foo =; set foo to an empty string

; foo = none; set foo to an empty string

; foo = "none"; set foo to the string 'none'

If you use constants in your value settings, and these constants belong to the dynamically called extension library (either an extension of PHP or

; Zend extension), you can only call in these extended lines * and then * use these constants.

All the values set in the php.ini-dist file are the same as the built-in default values (that is, if php.ini

; is not used or you delete these lines, the default value is the same.

; language options

Engine = On

; make PHP scripting language engine (PHP scripting language engine) effective under Apache.

Short_open_tag = On

; allow tags to be recognized.

Asp_tags = Off

; allow ASP-style tags

Precision = 14

The number of significant digits when floating-point type numbers are displayed

Y2k_compliance = Off

Whether to turn on Y2K adaptation (may cause problems in non-Y2K adapted browsers)

Output_buffering = Off

The output cache allows you to send header (headers, including cookies) lines even after you output the body content

The cost is that the output layer slows down a little bit You can use the output cache to open the output cache at run time

Or set the instruction here to On so that the output cache of all files is turned on.

Output_handler =; you can redirect all the output of your script to one function

That might be useful for processing or logging it.

For example, if you set this output_handler to "ob_gzhandler"

The output is transparently compressed for browsers that support gzip or deflate encoding

Set an output processor to turn on the output buffer automatically.

Implicit_flush = Off

Force flush (refresh) to have PHP tell the output layer to automatically refresh its data after each output block.

This is equivalent to calling the flush () function after each print () or echo () call and each HTML block.

Turning on this setting can cause serious runtime conflicts, it is recommended that you open it only during debug

Allow_call_time_pass_reference = On

Whether to force the argument to be passed by reference when the function is called This method met with protest

And may no longer be supported in future versions of PHP/Zend.

It is encouraged to specify which parameters are passed by reference in the function declaration.

You are encouraged to try to turn off this option and make sure that your script is still working properly to ensure that in future versions of the language

They can still work. (you will get a warning each time you use this feature, and the parameters will be by value rather than by reference

; pass).

; Safe Mode security mode

Safe_mode = Off

Safe_mode_exec_dir =

Safe_mode_allowed_env_vars = PHP_

;? Setting certain environment variables

;? May be a potential security breach.

This indication contains a comma-separated list of prefixes In safe mode, users can only replace

The value of the environment variable that begins with the prefix listed here

By default, users will only be able to set environment variables that start with PHP_, such as PHP_FOO=BAR.

Note: if this indication is empty, PHP will let the user change any environment variable!

Safe_mode_protected_env_vars = LD_LIBRARY_PATH

This instruction contains a comma-separated list of environment variables that the end user will not be able to change with putenv ()

These variables are protected even if safe_mode_allowed_env_vars is set to allow.

Disable_functions =

This instruction allows you to disable specific functions for security reasons.

It accepts a comma-separated list of function names

This instruction is * not affected by whether security mode is turned on or not.

The color of syntax highlight mode.

As long as it is acceptable, it can work.

Highlight.string = # DD0000

Highlight.comment = # FF8000

Highlight.keyword = # 007700

Highlight.bg = # FFFFFF

Highlight.default = # 0000BB

Highlight.html = # 000000

; Misc Miscellaneous

Expose_php = Off

; determine whether PHP marks the fact that it is installed on the server (for example: add it-PHP- to the Web service

; on the signal sent.

In my personal opinion, turn it off when there is any power-by header. )

It doesn't pose a security threat, but it makes it possible to check if PHP is installed on your server.

; Resource Limits

Max_execution_time = 30; maximum execution time of each script in seconds

Memory_limit = 8388608; the maximum amount of memory a script can use (in this case, 8MB)

; Error handling and logging

Error control and registration

Error reports are bitwise. Or add up the numbers to get the desired error reporting level.

; E_ALL-all errors and warnings

; E_ERROR-fatal runtime error

; E_WARNING-Runtime warning (non-fatal error)

; E_PARSE-compile-time parsing error

; E_NOTICE-Runtime reminders (these are often caused by the bug of your code

It may also be caused by intentional behavior. (for example, automatically initialize to a based on uninitialized variables

Use an uninitialized variable for the fact that an empty string is used)

; E_CORE_ERROR-A fatal error that occurs during initialization when PHP starts

; E_CORE_WARNING-warning that occurs during initialization when PHP starts (non-fatal error)

; E_COMPILE_ERROR-compile-time fatal error

; E_COMPILE_WARNING-compile-time warning (non-fatal error)

; E_USER_ERROR-error message generated by the user

; E_USER_WARNING-warning message generated by the user

; E_USER_NOTICE-reminder message generated by the user

; example:

; error_reporting = E_ALL & ~ E_NOTICE; shows all errors except reminders

; error_reporting = E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR; only errors are displayed

Error_reporting = E_ALL & ~ E_NOTICE; shows all errors except reminders

Display_errors = On; error message is displayed (as part of the output)

On the final released web site, it is strongly recommended that you turn off this feature and use the

Replace the error log (see below).

Continue to make display_errors effective in the final release of the web site

Expose some information about security, such as the file path on your web service,

Your database plan or other information.

Display_startup_errors = Off; even when display_erroes is turned on, it occurs in the startup step of PHP

; the error will not be displayed.

; it is strongly recommended that you keep display_startup_errors closed

Except in the process of correcting mistakes.

Log_errors = Off; record errors in the log file (server-specified log, stderr standard error output, or error_log (below))

As explained above, it is strongly recommended that you log errors in the final released web site

; replace direct error output.

Track_errors = Off; saves the most recent error / warning message in the variable $php_errormsg (boolean)

; error_prepend_string = ""; the string output before the error message

; error_append_string = ""; string output after the error message

; error_log = filename; logs errors in the specified file

; error_log = syslog; record the error log in the system log syslog (event log under NT, invalid under Windows 95)

Warn_plus_overloading = Off; warning when'+'is used for strings

; Data Handling

Variables_order = "EGPCS"; this instruction describes the PHP record

; GET, POST, Cookie, Environment and Built-in order of these variables.

; (represented by G, P, C, E & S, usually quoted as EGPCS or GPC).

As recorded from left to right, the new value replaces the old value.

Register_globals = On; whether to register these EGPCS variables as global variables.

If you don't want the user data to be cluttered globally, you may want to turn it off.

This makes more sense in conjunction with track_vars-so that you can pass the

; the $HTTP_*_VARS [] array accesses all GPC variables.

Register_argc_argv = On; this instruction tells PHP whether to declare argv and argc variables

; (note: here argv is an array and argc is the number of variables)

; (which contains data passed by the GET method).

If you don't want to use these variables, you should turn them off to improve performance.

Track_vars = On; make the $HTTP_*_VARS [] array valid, here * when in use

; ENV, POST, GET, COOKIE or SERVER replacement

Post_max_size = 8m; PHP will accept the maximum size of POST data.

Gpc_order = "GPC"; this instruction is opposed. Use variables_order instead.

; Magic quotes

Magic_quotes_gpc = On; use magic references in the input GET/POST/Cookie data

; (the original text is like this, hehe, the so-called magic quotes should refer to the escape character added to the citation control character, such as'.)

Magic_quotes_runtime= Off; use magic references to data generated at run time

For example, data queried by SQL, data obtained by exec () function, etc.

Magic_quotes_sybase = Off; magic quotation in the form of Sybase (with 'detach' instead of')

Automatically add files before and after PHP documents

Auto_prepend_file =

Auto_append_file =

Like 4.04b4, PHP always outputs a character encoding in the "Content-type:" header by default.

Invalidate the output character set, as long as it is set to empty.

; the built-in default value of PHP is text/html

Default_mimetype = "text/html"

; default_charset = "iso-8859-1"

; Paths and Directories

Include_path =; include path setting, UNIX: "/ path2:/path3" Windows: "\ path2;\ path3"

Doc_root =; the root path of the php page, valid only when it is not empty

User_dir =; tells php which directory to look in when opening a script using / ~ username, which is valid only when it is not empty

; upload_tmp_dir =; temporary directory for files uploaded using the HTTP protocol (use the system default when not specified)

Upload_max_filesize = 2097152; file upload is limited to 2 Meg by default

Extension_dir = c:\ php\; directory where loadable extension libraries (modules) are stored

Enable_dl = On; whether to make dl () valid.

The dl () function does not * work well on a multithreaded server

; for example, IIS or Zeus, on which it is disabled by default

; File Uploads

File_uploads = On; whether to allow file upload in HTTP mode

; upload_tmp_dir =; temporary directory for files uploaded by HTTP (system default is used if not specified)

Upload_max_filesize = 2m; maximum allowable size for uploaded files

; Fopen wrappers

Allow_url_fopen = On; whether URLs is allowed to be http:.. Or treat the file as a ftp:...

; dynamic expansion

; Dynamic Extensions

If you want an extension library to load automatically, use the following syntax:

; extension=modulename.extension

; for example, on windows

; extension=msql.dll

; or under UNIX

; extension=msql.so

Note that this should only be the name of the module and no directory information is required.

Use the extension_dir above to indicate the location of the extension library.

; Windows extension

; extension=php_nsmail.dll

Extension=php_calendar.dll

; extension=php_dbase.dll

; extension=php_filepro.dll

Extension=php_gd.dll

; extension=php_dbm.dll

; extension=php_mssql.dll

; extension=php_zlib.dll

; extension=php_filepro.dll

; extension=php_imap4r2.dll

; extension=php_ldap.dll

; extension=php_crypt.dll

; extension=php_msql2.dll

; extension=php_odbc.dll

Note that MySQL support is now built-in, so there is no need to use its dll

; module setting

; Module Settings

[Syslog]

Define_syslog_variables = Off; whether to define various Syslog variables

For example: $LOG_PID, $LOG_CRON, and so on.

It's a good idea to turn it off to improve efficiency.

At run time, you can call the function define_syslog_variables () to define these variables

[mail function]

SMTP = localhost; for win32 systems only

Sendmail_from = me@localhost.com; for win32 systems only

; sendmail_path =; for unix only, parameters are also supported (default is' sendmail-t-i')

[Debugger]

Debugger.host = localhost

Debugger.port = 7869

Debugger.enabled = False

[Logging]

These configurations indicate the logging mechanism used for the example

See examples/README.logging for more explanation

; logging.method = db

; logging.directory = / path/to/log/directory

[Java]

; java.class.path =.\ php_java.jar

; java.home = c:\ jdk

; java.library = c:\ jdk\ jre\ bin\ hotspot\ jvm.dll

; java.library.path =.\

[SQL]

Sql.safe_mode = Off

[ODBC]

; uodbc.default_db = Not yet implemented

; uodbc.default_user = Not yet implemented

; uodbc.default_pw = Not yet implemented

Uodbc.allow_persistent = On; allow or disable persistent connections

Uodbc.check_persistent = On; check whether the connection is still available before reuse

Uodbc.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Uodbc.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

Uodbc.defaultlrl = 4096; controls fields of type LONG. Returns the number of bytes of the variable, where 0 means passing (? ) 0 means passthru

Uodbc.defaultbinmode = 1; controls binary data. 0 stands for Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char

See the documentation on odbc_binmode and odbc_longreadlen for an explanation of uodbc.defaultlrl and uodbc.defaultbinmode.

[MySQL]

Mysql.allow_persistent = On; allow or disable persistent connections

Mysql.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Mysql.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

Mysql.default_port = the default port used by mysql_connect (). If not set, mysql_connect ()

; will use the variable $MYSQL_TCP_PORT, or the mysql-tcp entry under / etc/services (unix)

; or the MYSQL_PORT that is defined in the compilation (in this order)

; Win32 environment, only MYSQL_PORT will be checked.

Mysql.default_socket =; default socket name for local MySql connections. Null, use MYSQL built-in value

Mysql.default_host =; mysql_connect () the host used by default (invalid in safe mode)

Mysql.default_user =; mysql_connect () user name used by default (invalid in safe mode)

Mysql.default_password =; mysql_connect () default password (invalid in secure mode)

Note that saving passwords under this file is usually a bad idea

; * any * user who can access using PHP can run

; 'echo cfg_get_var ("mysql.default_password")' to display that password!

And, of course, any user who has the right to read the file can see the password.

[mSQL]

Msql.allow_persistent = On; allow or disable persistent connections

Msql.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Msql.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

[PostgresSQL]

Pgsql.allow_persistent = On; allow or disable persistent connections

Pgsql.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Pgsql.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

[Sybase]

Sybase.allow_persistent = On; allow or disable persistent connections

Sybase.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Sybase.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

; sybase.interface_file = "/ usr/sybase/interfaces"

Sybase.min_error_severity = 10; minimum severity of the error displayed

Sybase.min_message_severity = 10; minimum importance of the message displayed

Sybase.compatability_mode = Off; a mode that is compatible with older versions of PHP 3.0. If turned on, this will cause PHP to automatically

Assign them according to the Sybase type of the result

Instead of treating them all as strings.

This compatibility mode will not last forever

Therefore, make the necessary changes to your code

; and close the item.

[Sybase-CT]

Sybct.allow_persistent = On; allow or disable persistent connections

Sybct.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Sybct.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

Sybct.min_server_severity = 10; minimum severity of the error displayed

Sybct.min_client_severity = 10; minimum importance of the message displayed

[bcmath]

Bcmath.scale = 0; the number of decimal digits used for all bcmath functions number of decimal digits for all bcmath functions

[browscap]

; browscap = extra/browscap.ini

Browscap = C:\ WIN\ SYSTEM\ inetsrv\ browscap.ini

[Informix]

Ifx.default_host =; ifx_connect () the host used by default (invalid in safe mode)

Ifx.default_user =; ifx_connect () user name used by default (invalid in safe mode)

Ifx.default_password =; ifx_connect () default password (invalid in secure mode)

Ifx.allow_persistent = On; allow or disable persistent connections

Ifx.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Ifx.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

Ifx.textasvarchar = 0; if turned on, the select status character returns the contents of a 'text blob' field, not its id

Ifx.byteasvarchar = 0; if turned on, the select status character returns the contents of a 'byte blob' field, not its id

Ifx.charasvarchar = 0; tracks spaces stripped from fixed-length character columns.

; may be valid for Informix SE users.

Ifx.blobinfile = 0; if opened, the contents of text and byte blobs are exported to a file

; instead of saving to memory.

Ifx.nullformat = 0; NULL (empty) is returned as an empty field unless it is set to 1.

In this case (1), NULL is returned as the string NULL.

[Session]

Session.save_handler = files; control method for saving / retrieving data

Session.save_path = C:\ win\ temp; parameters passed to the controller when save_handler is set to a file

This is the path where the data file will be saved.

Session.use_cookies = 1; whether to use cookies or not

Session.name = PHPSESSID

The name of session used in cookie

Session.auto_start = 0; initialize session when the request is started

Session.cookie_lifetime = 0; the save time of the cookie recorded in seconds

; or 0 until the browser is restarted

Session.cookie_path = /; valid path to cookie

Session.cookie_domain =; valid domain of cookie

Session.serialize_handler = php; controller used to connect data

Php is the standard controller of PHP.

Session.gc_probability = 1; percentage of 'garbage collection' processes

; the possibility of starting each time the session is initialized.

Session.gc_maxlifetime = 1440; after the number of seconds indicated by the number here, the saved data will be regarded as

; 'garbage' and cleared by the gc process.

Session.referer_check =; check the HTTP reference to invalidate the additional ids contained in the URLs

Session.entropy_length = 0; how many bytes are read from the file

Session.entropy_file =; specify to set up the session id here

; session.entropy_length = 16

; session.entropy_file = / dev/urandom

Session.cache_limiter = nocache; set to {nocache,private,public} to determine the

; cache problem

Session.cache_expire = 180; the document becomes obsolete in n minutes

Session.use_trans_sid = 1; use transitional sid support, if licensed at compile time

;-- enable-trans-sid

Url_rewriter.tags = "axianghrefgrame arearefrereref _ ref _ frame _ r _ c _ entry

[MSSQL]

; extension=php_mssql.dll

Mssql.allow_persistent = On; allow or disable persistent connections

Mssql.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Mssql.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

Mssql.min_error_severity = 10; minimum severity of the error displayed

Mssql.min_message_severity = 10; minimum importance of the message displayed

Mssql.compatability_mode = Off; a mode that is compatible with older versions of PHP 3.0.

[Assertion]

;?

; assert.active = On;? Assert (expr); active by default

; assert.warning = On; issue a PHP warning for each failed assertion.

; assert.bail = Off; don't bail out by default.

; assert.callback = 0; user-function to be called if an assertion fails.

; assert.quiet_eval = 0; eval the expression with current error_reporting (). Set to true if you want error_reporting (0) around the eval ().

[Ingres II]

Ii.allow_persistent = On; allow or disable persistent connections

Ii.max_persistent =-1; maximum number of persistent connections. -1 stands for unlimited

Ii.max_links =-1; maximum number of connections (persistent and non-persistent). -1 stands for unlimited

Ii.default_database =; default database (format: [node_id::] dbname [/ srv_class])

Ii.default_user =; default user

Ii.default_password =; default password

[Verisign Payflow Pro]

Pfpro.defaulthost = "test.signio.com"; default Signio server

Pfpro.defaultport = 443; default port for connection

Pfpro.defaulttimeout = 30; default timeout in seconds

; pfpro.proxyaddress =; default IP address of the agent (if required)

; pfpro.proxyport =; default proxy port

; pfpro.proxylogon =; default agent login (logon user name)

; pfpro.proxypassword =; default agent password

[Sockets]

Sockets.use_system_read = On; use the system's read () function instead of php_read () encapsulation

; Local Variables: (local variable)

; tab-width: 4

; End

Thank you for reading! This is the end of this article on "sample analysis of php.ini configuration files". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report