php的配置文件详解
;;;;;;;;;;;;;;;;;
;; 关于php.ini ;;
;;;;;;;;;;;;;;;;;
; 这个文件必须命名为’php.ini’并放置在httpd.conf中PHPINIDir指令指定的目录中。
; 最新版本的php.ini可以在下面两个位置查看:
; http://cvs.php.net/viewvc.cgi/php-src/php.ini-recommended?view=co
; http://cvs.php.net/viewvc.cgi/php-src/php.ini-dist?view=co
;;;;;;;;;;;;
;; 语法 ;;
;;;;;;;;;;;;
; 该文件的语法非常简单。空白字符和以分号开始的行被简单地忽略。
; 章节标题(例如: [php])也被简单地忽略,即使将来它们可能有某种意义。
;
; 设置指令的格式如下:
; directive = value
; 指令名(directive)是大小写敏感的!所以”foo=bar”不同于”FOO=bar”。
; 值(value)可以是:
; 1. 用引号界定的字符串(如:”foo”)
; 2. 一个数字(整数或浮点数,如:0, 1, 34, -1, 33.55)
; 3. 一个PHP常量(如:E_ALL, M_PI)
; 4. 一个INI常量(On, Off, none)
; 5. 一个表达式(如:E_ALL & ~E_NOTICE)
;
; INI文件中的表达式仅使用:位运算符、逻辑非、圆括号:
; | 位或
; & 位与
; ~ 位非
; ! 逻辑非
;
; 布尔标志用 On 表示打开,用 Off 表示关闭。
;
; 一个空字符串可以用在等号后不写任何东西表示,或者用 none 关键字:
; foo = ; 将foo设为空字符串
; foo = none ; 将foo设为空字符串
; foo = “none” ; 将foo设为字符串’none’
;
; 如果你在指令值中使用动态扩展(PHP扩展或Zend扩展)中的常量,
; 那么你只能在加载这些动态扩展的指令行之后使用这些常量。
;;;;;;;;;;;;;;;;;;
;; httpd.conf ;;
;;;;;;;;;;;;;;;;;;
; 可以在httpd.conf中针对特定虚拟主机或目录覆盖php.ini的值,以进行更灵活的配置:
; php_admin_value name value ;设置非bool型的指令,将value设为none则清除先前的设定
; php_admin_flag name on|off ;仅用于设置bool型的指令
; [提示]因为很多指令不允许使用php_value/php_flag进行设置,因此不建议使用这两个。
;
; PHP常量(如E_ALL)仅能在php.ini中使用,在httpd.conf中必须使用相应的掩码值。
;[2008-3-2日更新]
;==========================================================================================
;;=====================================配置指令详解========================================
;==========================================================================================
; 以下每个指令的设定值都与 PHP-5.2.5 内建的默认值相同。
; 也就是说,如果’php.ini’不存在,或者你删掉了某些行,默认值与之相同。
;;;;;;;;;;;;;;
;; Apache ;;
;;;;;;;;;;;;;;
[Apache]
; 仅在将PHP作为Apache模块时才有效。
child_terminate = Off
; PHP脚本在请求结束后是否允许使用apache_child_terminate()函数终止子进程。
; 该指令仅在UNIX平台上将PHP安装为Apache1.3的模块时可用。其他情况下皆不存在。
engine = On
; 是否启用PHP解析引擎。
; 提示:可以在httpd.conf中基于目录或者虚拟主机来打开或者关闭PHP解析引擎。
last_modified = Off
; 是否在Last-Modified应答头中放置该PHP脚本的最后修改时间。
xbithack = Off
; 是否不管文件结尾是什么,都作为PHP可执行位组来解析。
;;;;;;;;;;;;;;;
;; PHP核心 ;;
;;;;;;;;;;;;;;;
[PHP-Core-DateTime]
; 前四个配置选项目前仅用于date_sunrise()和date_sunset()函数。
date.default_latitude = 31.7667
; 默认纬度
date.default_longitude = 35.2333
; 默认经度
date.sunrise_zenith = 90.583333
; 默认日出天顶
date.sunset_zenith = 90.583333
; 默认日落天顶
date.timezone =
; 未设定TZ环境变量时用于所有日期和时间函数的默认时区。
; 中国大陆应当使用”PRC”
; 应用时区的优先顺序为:
; 1. 用date_default_timezone_set()函数设定的时区(如果设定了的话)
; 2. TZ 环境变量(如果非空的话)
; 3. 该指令的值(如果设定了的话)
; 4. PHP自己推测(如果操作系统支持)
; 5. 如果以上都不成功,则使用 “UTC”
[PHP-Core-Assert]
assert.active = On
; 是否启用assert()断言评估
assert.bail = Off
; 是否在发生失败断言时中止脚本的执行
assert.callback =
; 发生失败断言时执行的回调函数
assert.quiet_eval = Off
; 是否使用安静评估(不显示任何错误信息,相当于error_reporting=0)。
; 若关闭则在评估断言表达式的时候使用当前的error_reporting指令值。
assert.warning = On
; 是否对每个失败断言都发出警告
[PHP-Core-SafeMode]
; 安全模式是为了解决共享服务器的安全问题而设立的。
; 但试图在PHP层解决这个问题在结构上是不合理的,
; 正确的做法应当是修改web服务器层和操作系统层。
; 因此在PHP6中废除了安全模式,并使用基于open_basedir的安全防护。
; 此部分指令在PHP6中已经全部被删除。
safe_mode = Off
; 是否启用安全模式。
; 打开时,PHP将检查当前脚本的拥有者是否和被操作的文件的拥有者相同,
; 相同则允许操作,不同则拒绝操作。
safe_mode_gid = Off
; 在安全模式下,默认在访问文件时会做UID比较检查。
; 但有些情况下严格的UID检查反而是不适合的,宽松的GID检查已经足够。
; 如果你想将其放宽到仅做GID比较,可以打开这个参数。
safe_mode_allowed_env_vars = “PHP_”
; 在安全模式下,用户仅可以更改的环境变量的前缀列表(逗号分隔)。
; 允许用户设置某些环境变量,可能会导致潜在的安全漏洞。
; 注意: 如果这一参数值为空,PHP将允许用户更改任意环境变量!
safe_mode_protected_env_vars = “LD_LIBRARY_PATH”
; 在安全模式下,用户不能更改的环境变量列表(逗号分隔)。
; 这些变量即使在safe_mode_allowed_env_vars指令设置为允许的情况下也会得到保护。
safe_mode_exec_dir = “/usr/local/php/bin”
; 在安全模式下,只有该目录下的可执行程序才允许被执行系统程序的函数执行。
; 这些函数是:system, escapeshellarg, escapeshellcmd, exec, passthru,
; proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec
safe_mode_include_dir =
; 在安全模式下,该组目录和其子目录下的文件被包含时,将跳过UID/GID检查。
; 换句话说,如果此处的值为空,任何UID/GID不符合的文件都不允许被包含。
; 这里设置的目录必须已经存在于include_path指令中或者用完整路径来包含。
; 多个目录之间用冒号(Win下为分号)隔开。
; 指定的限制实际上是一个前缀,而非一个目录名,
; 也就是说”/dir/incl”将允许访问”/dir/include”和”/dir/incls”
; 如果您希望将访问控制在一个指定的目录,那么请在结尾加上斜线。

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function