Tệp cấu hình PHP của tôi ở đâu?

Bạn có cần thay đổi wp-config của mình không. php [tệp cấu hình]? . php cho trang web WordPress của bạn

Lưu ý . Chúng tôi thực sự khuyên bạn nên sao lưu WordPress trước khi thực hiện bất kỳ thay đổi nào đối với tệp wp-config của mình.

Nơi tìm wp-config của bạn. tập tin php

wp-config. php là một trong những tệp quan trọng nhất trong cài đặt WordPress của bạn. Tệp này chứa chi tiết cấu hình trang web của bạn và nằm trong thư mục gốc của thư mục tệp WordPress của bạn

wp-config. tệp php không được bao gồm tự động khi bạn tải xuống hoặc cài đặt WordPress lần đầu tiên. Quá trình thiết lập WordPress tạo một wp-config. php dựa trên thông tin bạn cung cấp

 

 

 

 

 

 

 

 

 

 

Bạn sẽ cần tải xuống tệp wp-config qua FTP hoặc Trình quản lý tệp của cPanel

wp-config. php thường nằm trong thư mục gốc của trang web của bạn với các thư mục khác như /wp-content/

 

 

 

 

 

 

 

Khi bạn đã tải xuống wp-config. php, bạn có thể thực hiện các thay đổi phù hợp rồi tải lại lên máy chủ web của mình. Trước khi bạn thực hiện bất kỳ thay đổi nào đối với tệp cấu hình của mình, chúng tôi khuyên bạn nên tạo bản sao lưu của WordPress. Ngoài ra, vì tệp này chứa thông tin nhạy cảm, chúng tôi khuyên bạn không nên chỉnh sửa tệp trừ khi bạn cần.  

PHP là một trong những ngôn ngữ quan trọng nhất trên Internet. Nhiều hệ thống quản lý nội dung như WordPress, TYPO3 hay Joomla đều dựa trên PHP. Với việc phát hành PHP 8, nhiều tính năng mới đã được giới thiệu. Ngoài ra, một số tính năng cũ đã được làm lại, nghĩa là có thể xảy ra lỗi nếu mã không được cập nhật. Bạn có thể tìm thấy tất cả các thông tin quan trọng về các tính năng mới của PHP 8 tại đây

Tệp cấu hình [php. ini] được đọc khi PHP khởi động. Đối với các phiên bản mô-đun máy chủ của PHP, điều này chỉ xảy ra một lần khi máy chủ web khởi động. Đối với các phiên bản CGI và CLI, nó xảy ra trên mọi lệnh gọi

php. ini được tìm kiếm ở những vị trí này [theo thứ tự]

  • Vị trí cụ thể của mô-đun SAPI [chỉ thị ____15 trong Apache 2, tùy chọn dòng lệnh
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    6 trong CGI và CLI]
  • Biến môi trường PHPRC
  • Vị trí của tệp
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    7 có thể được đặt cho các phiên bản PHP khác nhau. Thư mục gốc của các khóa đăng ký phụ thuộc vào độ 32 hoặc 64 bit của HĐH và PHP đã cài đặt. Đối với PHP 32-bit trên hệ điều hành 32-bit hoặc PHP 64-bit trên hệ điều hành 64-bit, hãy sử dụng
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    8 cho phiên bản 32-bit của PHP trên hệ điều hành 64-bit, hãy sử dụng
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    9]. Để cài đặt bitness tương tự, các khóa đăng ký sau được kiểm tra theo thứ tự.
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    0,
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    1 và
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    0, trong đó x, y và z có nghĩa là các phiên bản chính, phụ và phát hành của PHP. Đối với các phiên bản 32 bit của PHP trên hệ điều hành 64 bit, các khóa đăng ký sau được kiểm tra theo thứ tự.
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    1,
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    2 và
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    3, trong đó x, y và z có nghĩa là các phiên bản chính, phụ và phát hành của PHP. Nếu có giá trị cho
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    4 trong bất kỳ khóa nào trong số này, thì khóa đầu tiên được tìm thấy sẽ được sử dụng làm vị trí của
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    7 [chỉ dành cho Windows]
  • ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    6 hoặc
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    9, giá trị của
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    4 [Chỉ dành cho Windows]
  • Thư mục làm việc hiện tại [ngoại trừ CLI]
  • Thư mục của máy chủ web [đối với các mô-đun SAPI] hoặc thư mục của PHP [nếu không thì trong Windows]
  • Thư mục Windows [C. \windows hoặc C. \winnt] [dành cho Windows] hoặc tùy chọn thời gian biên dịch
    ; any text on a line after an unquoted semicolon [;] is ignored
    [php] ; section markers [text within square brackets] are also ignored
    ; Boolean values can be set to either:
    ;    true, on, yes
    ; or false, off, no, none
    register_globals = off
    track_errors = yes
    
    ; you can enclose strings in double-quotes
    include_path = ".:/usr/local/lib/php"
    
    ; backslashes are treated the same as any other character
    include_path = ".;c:\php\lib"
    9

Nếu php-SAPI. ini tồn tại [trong đó SAPI là SAPI đang được sử dụng, vì vậy, ví dụ: php-cli. ini hoặc php-apache. ini], nó được sử dụng thay cho php. ban đầu. Tên SAPI có thể được xác định bằng php_sapi_name[]

Ghi chú

Máy chủ web Apache thay đổi thư mục gốc khi khởi động, khiến PHP cố đọc php. ini từ hệ thống tập tin gốc nếu nó tồn tại

Sử dụng biến môi trường có thể được sử dụng trong php. ini như hình bên dưới

Ví dụ #1 php. ini Biến môi trường

________số 8

php. ini được xử lý bởi các tiện ích mở rộng được ghi lại trên các trang tương ứng của chính các tiện ích mở rộng đó. Một danh sách các chỉ thị cốt lõi có sẵn trong phần phụ lục. Không phải tất cả các lệnh PHP nhất thiết phải được ghi lại trong hướng dẫn này. để biết danh sách đầy đủ các chỉ thị có sẵn trong phiên bản PHP của bạn, vui lòng đọc php được nhận xét tốt của bạn. tập tin ini. Ngoài ra, bạn có thể tìm thấy » php mới nhất. ini từ Git cũng hữu ích

Ví dụ #2 php. ví dụ ban đầu

; any text on a line after an unquoted semicolon [;] is ignored
[php] ; section markers [text within square brackets] are also ignored
; Boolean values can be set to either:
;    true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes

; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"

; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"

Có thể tham khảo hiện có. ini biến từ bên trong. tập tin ini. Ví dụ.

; any text on a line after an unquoted semicolon [;] is ignored
[php] ; section markers [text within square brackets] are also ignored
; Boolean values can be set to either:
;    true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes

; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"

; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"
00

Quét thư mục

Có thể cấu hình PHP để quét. ini trong một thư mục sau khi đọc php. ban đầu. Điều này có thể được thực hiện tại thời điểm biên dịch bằng cách đặt tùy chọn --with-config-file-scan-dir. Sau đó, thư mục quét có thể được ghi đè trong thời gian chạy bằng cách đặt biến môi trường PHP_INI_SCAN_DIR

Có thể quét nhiều thư mục bằng cách tách chúng bằng trình tách đường dẫn dành riêng cho nền tảng [

; any text on a line after an unquoted semicolon [;] is ignored
[php] ; section markers [text within square brackets] are also ignored
; Boolean values can be set to either:
;    true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes

; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"

; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"
01 trên Windows, NetWare và RISC OS;
; any text on a line after an unquoted semicolon [;] is ignored
[php] ; section markers [text within square brackets] are also ignored
; Boolean values can be set to either:
;    true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes

; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"

; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"
02 trên tất cả các nền tảng khác; giá trị mà PHP đang sử dụng có sẵn dưới dạng hằng số
; any text on a line after an unquoted semicolon [;] is ignored
[php] ; section markers [text within square brackets] are also ignored
; Boolean values can be set to either:
;    true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes

; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"

; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"
03]. Nếu một thư mục trống được cung cấp trong PHP_INI_SCAN_DIR, PHP cũng sẽ quét thư mục được cung cấp tại thời điểm biên dịch thông qua --with-config-file-scan-dir

Trong mỗi thư mục, PHP sẽ quét tất cả các tệp kết thúc bằng

; any text on a line after an unquoted semicolon [;] is ignored
[php] ; section markers [text within square brackets] are also ignored
; Boolean values can be set to either:
;    true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes

; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"

; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"
04 theo thứ tự bảng chữ cái. Danh sách các tệp đã được tải và thứ tự có sẵn bằng cách gọi php_ini_scanned_files[] hoặc bằng cách chạy PHP với tùy chọn --ini

Tôi có thể tìm tệp PHP ở đâu?

Câu trả lời của bạn .
Bạn có thể nhận được một phpinfo[] đầy đủ bằng cách sử dụng. php -i
Và, trong đó, có php. tập tin ini được sử dụng. $ php -i. grep 'Tệp cấu hình' Tệp cấu hình [php. ini] Đường dẫn => /etc Tệp cấu hình đã tải => /etc/php. ban đầu
Trên Windows, hãy sử dụng tìm thay thế. php -i. tìm/a"tệp cấu hình" Hy vọng điều này hữu ích

Tệp cấu hình PHP Linux ở đâu?

Vị trí mặc định cho php. tập tin ini là. Ubuntu 16. 04. /etc/php/7. 0/apache2 . CentOS 7. /etc/php.

Tệp ini PHP ở đâu trong Windows?

Trong Windows Explorer, hãy mở thư mục cài đặt PHP của bạn, chẳng hạn như C. \PHP . Trong trình soạn thảo văn bản, hãy mở tệp php. tập tin ini.

Phpinfo PHP nằm ở đâu?

Kiểm tra thông tin PHP bằng Bảng điều khiển dịch vụ lưu trữ . Sau đó, bạn sẽ được chuyển tiếp đến một trang có thông tin chi tiết về phiên bản, mô-đun và giá trị PHP hiện tại của bạn, v.v. Advanced -> PHP Info. You'll then be forwarded to a page with detailed information about your current PHP version, modules, and values, etc.

Chủ Đề