php. File ini adalah file khusus untuk PHP. Di sinilah Anda mendeklarasikan perubahan pada pengaturan PHP Anda. Server sudah dikonfigurasi dengan pengaturan standar untuk PHP, yang akan digunakan situs Anda secara default. Kecuali Anda perlu mengubah satu atau lebih pengaturan, tidak perlu membuat atau memodifikasi php. file ini. Jika Anda ingin melakukan perubahan pada pengaturan, silakan lakukan melalui Editor MultiPHP INI
Cara Memodifikasi Pengaturan PHP melalui Editor MultiPHP INI
Mungkin ada saatnya Anda perlu mengubah beberapa pengaturan default PHP, dan di bawah ini kami telah menguraikan langkah-langkahnya. Namun, perlu diingat bahwa ada Pengaturan PHP yang Tidak Dapat Diubah di Hosting Berbagi Pakai, Cloud, & Reseller kami
Untuk mengubah pengaturan PHP
- Masuk ke cPanel
- Di bagian Software, klik ikon MultiPHP INI Editor
- Pada halaman Editor MultiPHP INI, pilih Home Directory atau domain spesifik yang ingin Anda perbarui dari dropdown Configure PHP INI basic settings
- Pilih pengaturan baru untuk setiap direktif PHP yang ingin Anda ubah
- Klik Terapkan di bagian bawah untuk menyimpan perubahan Anda
Cara Membuat php baru. ini File
Catatan penting. HostGator tidak akan tahu mengapa Anda ingin atau perlu mengubah pengaturan ini. Anda akan mengubahnya atas saran perancang web atau pengembang skrip Anda. HostGator hanya dapat menunjukkan tempat untuk melakukan perubahan
Bayangkan Anda diberi server dan Anda diminta untuk mengubah pengaturan PHP-nya. Juga, asumsikan bahwa beberapa versi PHP yang berbeda diinstal di server ini. Menurut Anda apa cara terbaik untuk menemukan file konfigurasi PHP?
Metode 1 [file phpinfo]
Salah satu cara untuk mengetahui dengan tepat php.ini yang mana. Ini file yang digunakan server web Anda adalah dengan membuat file PHP baru di root dokumen yang disebut info. php
Muat file ini di browser Anda, tekan CTRL + F dan cari "Loaded Configuration File". Anda harus melihat sesuatu seperti
Ini akan memberitahu Anda lokasi yang tepat dari php. file ini yang ingin Anda edit
Metode 2 [PHP. perintah ini & grep]
Di Linux, jalankan perintah ini untuk mencari lokasi PHP. ini file konfigurasi
$ php -i | grep "Loaded Configuration File"_
Atau cara yang lebih baik
$ php -i | grep ini
Atau di Baris Perintah Windows
$ php -i | findstr /c:"Loaded Configuration File"
Hasilnya harus seperti ini
$ Loaded Configuration File => /etc/php/7.4/cli/php.ini_
Metode 3 [menemukan perintah]
Menggunakan perintah loc di Linux. Jika belum terinstal, jalankan sudo apt install mlocate [On Debian/Ubuntu] dan sudo yum install mlocate [On CentOS/RHEL]
File konfigurasi [php. ini] dibaca saat PHP dijalankan. Untuk versi modul server PHP, ini terjadi hanya sekali saat server web dimulai. Untuk versi CGI dan CLI, ini terjadi pada setiap pemanggilan
php. ini dicari di lokasi ini [berurutan]
- Lokasi spesifik modul SAPI [
PHPIniDir
_ direktif di Apache 2,-c
opsi baris perintah di CGI dan CLI] - Variabel lingkungan PHPRC
- Lokasi file
php.ini
_ dapat diatur untuk versi PHP yang berbeda. Akar kunci registri tergantung pada 32- atau 64-bit dari OS dan PHP yang diinstal. Untuk PHP 32-bit pada OS 32-bit atau PHP 64-bit pada OS 64-bit, gunakan[[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
untuk PHP versi 32-bit pada OS 64-bit gunakan[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PHP]
] sebagai gantinya. Untuk instalasi bitness yang sama, kunci registri berikut diperiksa secara berurutan.[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z]
,[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y]
dan; 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, di mana x, y dan z berarti versi mayor, minor, dan rilis PHP. Untuk versi 32 bit PHP pada OS 64 bit, kunci registri berikut diperiksa secara berurutan.; 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 dan; 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, di mana x, y dan z berarti versi utama, minor, dan rilis PHP. Jika ada nilai untuk; 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 di salah satu kunci ini, yang pertama ditemukan akan digunakan sebagai lokasiphp.ini
[khusus 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 atau[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PHP]
, nilai; 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 [khusus Windows]- Direktori kerja saat ini [kecuali CLI]
- Direktori server web [untuk modul SAPI], atau direktori PHP [jika tidak di Windows]
- Direktori Windows [C. \windows atau C. \winnt] [untuk Windows], atau
; 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 opsi waktu kompilasi
Jika php-SAPI. ini ada [di mana SAPI adalah SAPI yang digunakan, jadi, misalnya, php-cli. ini atau php-apache. ini], ini digunakan sebagai pengganti php. ini. Nama SAPI dapat ditentukan dengan php_sapi_name[]
Catatan
Server web Apache mengubah direktori menjadi root saat startup, menyebabkan PHP mencoba membaca php. ini dari sistem file root jika ada
Menggunakan variabel lingkungan dapat digunakan di php. ini seperti yang ditunjukkan di bawah ini
Contoh #1 php. ini Variabel Lingkungan
; PHP_MEMORY_LIMIT is taken from environment memory_limit = ${PHP_MEMORY_LIMIT}
php. Ini arahan ditangani oleh ekstensi didokumentasikan pada halaman masing-masing ekstensi itu sendiri. Daftar arahan inti tersedia di lampiran. Tidak semua arahan PHP harus didokumentasikan dalam manual ini. untuk daftar lengkap arahan yang tersedia dalam versi PHP Anda, silakan baca php Anda yang dikomentari dengan baik. file ini. Atau, Anda dapat menemukan » php.ini terbaru. ini dari Git juga membantu
Contoh #2 php. ini contoh
; 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"
Dimungkinkan untuk merujuk pada yang sudah ada. variabel ini dari dalam. file ini. Contoh.
Assuming PHP is configured with --with-config-file-scan-dir=/etc/php.d, and that the path separator is :... $ php PHP will load all files in /etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d php PHP will load all files in /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=:/usr/local/etc/php.d php PHP will load all files in /etc/php.d/*.ini, then /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php PHP will load all files in /usr/local/etc/php.d/*.ini, then /etc/php.d/*.ini as configuration files.0
Pindai direktori
Dimungkinkan untuk mengonfigurasi PHP untuk memindai. Ini file dalam direktori setelah membaca php. ini. Ini dapat dilakukan pada waktu kompilasi dengan menyetel opsi --with-config-file-scan-dir. Direktori pemindaian kemudian dapat ditimpa saat dijalankan dengan menyetel variabel lingkungan PHP_INI_SCAN_DIR
Dimungkinkan untuk memindai banyak direktori dengan memisahkannya dengan pemisah jalur khusus platform [
Assuming PHP is configured with --with-config-file-scan-dir=/etc/php.d, and that the path separator is :... $ php PHP will load all files in /etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d php PHP will load all files in /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=:/usr/local/etc/php.d php PHP will load all files in /etc/php.d/*.ini, then /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php PHP will load all files in /usr/local/etc/php.d/*.ini, then /etc/php.d/*.ini as configuration files.1 pada Windows, NetWare dan RISC OS;
Assuming PHP is configured with --with-config-file-scan-dir=/etc/php.d, and that the path separator is :... $ php PHP will load all files in /etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d php PHP will load all files in /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=:/usr/local/etc/php.d php PHP will load all files in /etc/php.d/*.ini, then /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php PHP will load all files in /usr/local/etc/php.d/*.ini, then /etc/php.d/*.ini as configuration files.2 pada semua platform lain; nilai yang digunakan PHP tersedia sebagai konstanta
Assuming PHP is configured with --with-config-file-scan-dir=/etc/php.d, and that the path separator is :... $ php PHP will load all files in /etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d php PHP will load all files in /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=:/usr/local/etc/php.d php PHP will load all files in /etc/php.d/*.ini, then /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php PHP will load all files in /usr/local/etc/php.d/*.ini, then /etc/php.d/*.ini as configuration files.3]. Jika direktori kosong diberikan dalam PHP_INI_SCAN_DIR, PHP juga akan memindai direktori yang diberikan pada waktu kompilasi melalui --with-config-file-scan-dir
Dalam setiap direktori, PHP akan memindai semua file yang diakhiri dengan
Assuming PHP is configured with --with-config-file-scan-dir=/etc/php.d, and that the path separator is :... $ php PHP will load all files in /etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d php PHP will load all files in /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=:/usr/local/etc/php.d php PHP will load all files in /etc/php.d/*.ini, then /usr/local/etc/php.d/*.ini as configuration files. $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php PHP will load all files in /usr/local/etc/php.d/*.ini, then /etc/php.d/*.ini as configuration files.4 dalam urutan abjad. Daftar file yang dimuat, dan urutannya, tersedia dengan memanggil php_ini_scanned_files[], atau dengan menjalankan PHP dengan opsi --ini