Home Backend Development PHP Tutorial Beginner's guide to PHP: php.ini configuration detailed options_PHP tutorial

Beginner's guide to PHP: php.ini configuration detailed options_PHP tutorial

Jul 13, 2016 pm 05:29 PM
php php.ini start up exist guide yes detailed Options Configuration

php.ini 或 php3.ini 是 PHP 在启动时会读取的配置文件。该文件的存放路径为 /usr/local/lib/。在 PHP 3.x 版的配置文件为 php3.ini;而在 PHP 4.x 版改为 php.ini。若 PHP 安装成服务器的模块,则在 Web 服务器启动执行时会读取,之后就不再读取,因此改动配置的话要重新启动 Web 服务器。若使用独立 PHP CGI 方式,则每次都读一次。

要看目前的系统配置,可以用phpinfo()看到。以下为选项配置

php_value name value
配置变量名称和值。本选项需 PHP 4.x 版之后才能使用。

php_flag name on|off
配置标志布尔变量选项。本选项需 PHP 4.x 版之后才能使用。

php_admin_value name value
配置 Apache 的配置文件变量。原来在 .htaccess 的配置改到这个选项配置。本选项需 PHP 4.x 版之后才能使用。

php_admin_flag name on|off
配置布尔变量当标志。本选项需 PHP 4.x 版之后才能使用。

asp_tags boolean
配置 PHP 程序是否解析以 ASP Script 语法 <% %> 的标记 (tag)。本选项在 PHP 3.0.4 之后才可使用。更多的细节可以参考>嵌入方法的部份。

auto_append_file string
配置本选项可以让指定的文件附加在原 PHP 程序后面自动执行。若 PHP 程序中有用到 exit() 函数,则指定的文件不会执行。参数 string 即为指定自动执行的文件。

auto_prepend_file string
配置本选项可以让指定的文件在原 PHP 程序之前自动执行。参数 string 即为指定自动执行的文件。

cgi_ext string
本选项配置 CGI 程序的扩展名。

display_errors boolean
本选项配置是否要将执行的错误信息显示在用户的浏览器上。

doc_root string
配置服务器的文件及 PHP 文件放置的根目录。

engine boolean
本选项需要使用apache的模块方式使用 PHP。可配置是否要使用 PHP 引擎。在 httpd.conf 中加入 php3_engine on/off 亦可配置某目录或某虚拟网站是否要用 PHP 解析器。

error_log string
本选项用来配置错误记录文件。在 UNIX 系统上参数 string 即为文件名。Windows NT 会将记录记在事件检视器的日志之中。Windows 95/98 则不支持系统记录。

error_reporting integer
本选项用来配置系统记录的等级。参数 integer 即为等级的级数标志,可以加在一起,默认值为 7,见下表
级数 说明
1 一般的错误
2 一般的警告
4 解析错误
8 非关键的警告


open_basedir string
本选项用来配置提供 PHP 存取的最底层目录。从该指定目录之下的文件或目录,PHP 程序才能存取。使用本选项主要是为了系统安全性的考虑。参数 string 即为要限制的最底层目录节点。值得注意的是在 UNIX 系统中,若该节点之下的文件或目录有符号链结 (symbolic link),则可能会让使用本选项的目的打折,因此在目录的设计上考虑,也是 Webmaster 的重要任务。默认值是所有文件均可存取。在 PHP 3.0.7 版之后,可以配置多个底层目录。

gpc_order string
配置 GET/POST/COOKIE 三种模块的顺序及规则。参数 string 即为要配置的规则,例如:配置成 "GP" 表示忽视 cookie,并在存取方法 (method) 相同时,以 POST 取代 GET。

ignore_user_abort string
默认值为 Off。用来配置当传输未完成时,用户端断线是要继续处理。

include_path string
为 PHP 程序中 require、include 及 fopen_with_path 等函数的文件搜寻路径。在 UNIX 或 Windows 中的斜线方向不同。

log_errors boolean
指定程序错误时是否要记录在 log 文件中。

magic_quotes_gpc boolean
配置 GET/POST/COOKIE 三种模块的特殊字符,包含单引号、双引号、反斜线、及空字符 (NUL) 是否要自动加入反斜线当溢出字符。

magic_quotes_runtime boolean
配置返回资料是否自动加入反斜线当溢出字符。

magic_quotes_sybase boolean
配置 sybase 资料中单引号要自动加上反斜线当溢出字符。

max_execution_time integer
配置程序最久执行时间。单位是秒。

memory_limit integer
配置程序最多使用多少内存。

short_open_tag boolean
配置是否使用短的 PHP 标记 ()。若不使用,则必须要用

track_errors boolean
打开本选项可使最后的错误信息跟着全局变量 $php_errormsg。

track_vars boolean
打开本选项可让用户输入的字符串自动解析到变量之中,而不用自己处理。

upload_tmp_dir string
指定上传文件临时路径。

user_dir string
指定用户根目录的路径。

warn_plus_overloading boolean
若打开本选项,字符串间就只能用英文的句号 (.) 链接,而不能用加号 (+) 链接字符串。

SMTP string
在 Windows 系列操作系统中,用来指定 SMTP 服务器,供 mail 函数使用。参数 string 为 SMTP 服务器名字。

sendmail_from string
配置 "From: " 字符串供 Windows 系列操作系统使用 mail 函数。

sendmail_path string
配置 sendmail 程序的放置路径。例如 /usr/sbin/sendmail。

safe_mode boolean
配置 PHP 在安全模式下执行。

safe_mode_exec_dir string
配置安全模式程序执行的路径。

debugger.host string
指定远端调试的服务器名称,可以是 IP 或 Domain Name。

debugger.port string
配置远端调试服务器的端口 (port)。

debugger.enabled boolean
配置是否可以为调试模式。

enable_dl boolean
本选项要使用apache模块 (Apache module) 的方式才有效。用来配置 PHP 的函数可否作用。当系统处于安全模式 (safe-mode) 时,本选项 enable 也无法使用 dl() 函数。

extension_dir string
配置动态函数的路径。

extension string
PHP 启动时所要载入的动态扩充功能。

mysql.allow_persistent boolean
配置是否允许 MySQL 数据库持续连接 (persistent connections),会影响函数。

mysql.max_persistent integer
配置每个处理程序最多保持几个 MySQL 持续连接。

mysql.max_links integer
配置每个处理程序最多开几个 MySQL 连接,包括持续连接。

msql.allow_persistent boolean
配置是否允许 mSQL 数据库持续连接 (persistent connections),会影响函数。

msql.max_persistent integer
配置每个处理程序最多保持几个 mSQL 持续连接。

msql.max_links integer
配置每个处理程序最多开几个 mSQL 连接,包括持续连接。

pgsql.allow_persistent boolean
配置是否允许 Postgres 数据库持续连接 (persistent connections),会影响函数。

pgsql.max_persistent integer
配置每个处理程序最多保持几个 Postgres 持续连接。

pgsql.max_links integer
配置每个处理程序最多开几个 Postgres 连接,包括持续连接。

sybase.allow_persistent boolean
配置是否允许 Sybase 数据库持续连接 (persistent connections),会影响函数。

sybase.max_persistent integer
配置每个处理程序最多保持几个 Sybase 持续连接。

sybase.max_links integer
配置每个处理程序最多开几个 Sybase 连接,包括持续连接。

sybct.allow_persistent boolean
配置是否允许 Sybase-CT 数据库持续连接 (persistent connections),默认值是打开的。

sybct.max_persistent integer
配置每个处理程序最多保持几个 Sybase-CT 持续连接。默认值为 -1 表示无限制。

sybct.max_links integer
配置每个处理程序最多开几个 Sybase-CT 连接,包括持续连接。默认值为 -1,表示没有限制。

sybct.min_server_severity integer
配置 Sybase-CT 服务器错误报告的最少笔数。默认值为 10。

sybct.min_client_severity integer
配置 Sybase-CT 客户端错误报告的最少笔数。默认值为 10。

sybct.login_timeout integer
配置 Sybase-CT 最久可以使用的登入时间。默认值为 1 分钟。

sybct.timeout integer
配置 Sybase-CT 的 query 操作时间限制。默认值为无限制。

sybct.hostname string
配置 Sybase-CT 可连接机器名称。默认值不设限

ifx.allow_persistent boolean
配置是否允许 Informix 数据库持续连接 (persistent connections),会影响函数。

ifx.max_persistent integer
配置每个处理程序最多保持几个 Informix 持续连接。

ifx.max_links integer
配置每个处理程序最多开几个 Informix 连接,包括持续连接。

ifx.default_host string
配置 Informix 默认连接的服务器名称,供ifx_connect()或ifx_pconnect()函数使用。

ifx.default_user string
配置 Informix 默认连接的用户帐号,供ifx_connect()或ifx_pconnect( 函数使用。

ifx.default_password string
配置 Informix 默认连接的用户密码,供ifx_connect()或ifx_pconnect() 函数使用。

ifx.blobinfile boolean
配置 Informix 长位类模式,0 表在内存;1 表在文件中。亦可以在 PHP 程序中使用ifx_blobinfile_mode()函数来修改。

ifx.textasvarchar boolean
Configure the default value of Informix text mode, 0 means return blob code; 1 means return

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531658.htmlTechArticlephp.ini or php3.ini is the configuration file that PHP will read when it starts. The storage path of this file is /usr/local/lib/. In PHP 3.x version, the configuration file is php3.ini; in PHP 4.x version, it is changed to...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1255
24
PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP vs. Other Languages: A Comparison PHP vs. Other Languages: A Comparison Apr 13, 2025 am 12:19 AM

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

See all articles