php_ini_scanned_files

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

php_ini_scanned_filesRestituisce l'elenco dei file .ini leti dalla directory ini aggiuntiva

Descrizione

php_ini_scanned_files(): string

php_ini_scanned_files() restituisce un elenco separato da virgola dei file di configurazione letti dopo il php.ini. Questi file sono cercati nella directory specificata dall'opzione --with-config-file-scan-dir impostata al momento della compila.

La funzione restituisce la lista separata da virgola se riesce. Al contrario, se l'impostazione --with-config-files-scan-dir non è configurata la funzione resttuisce false. Se un file non è riconoscibile, questo sarà inserito nell'elenco restituito, ma il PHP darà errore. Questo errore sarà visualizzato sia al momento della compila sia utilizzando php_ini_scanned_files().

La lista restituita comprende anche il percorso di include specificato in --with-config-file-scan-dir. Ogni virgola è seguita da un carattere di a capo (newline).

Example #1 Un semplice esempio di lista restuita dalla funzione

<?php
if ($filelist = php_ini_scanned_files()) {
if (
strlen($filelist) > 0) {
$files = explode(',', $filelist);

foreach (
$files as $file) {
echo
"<li>" . trim($file) . "</li>\n";
}
}
}
?>

Vedere anche ini_set() e phpinfo().

add a note add a note

User Contributed Notes 1 note

up
0
atesin () gmail ! com
4 years ago
<warning>

until i load more .ini files from <php-dir>/php.d/ as listed in phpinfo() (sections "Scan this dir for additional .ini files" and "Additional .ini files parsed"), php_ini_scanned_files() returns me NOTHING!

then i realized my php binary was not compiled with the "--with-config-file-scan-dir" option as listed in phpinfo() (section "Configure Command")

then i remembered the additional .ini files dir was set through the "PHP_INI_SCAN_DIR" system variable (new since php 5.2.0, see https://php.net/manual/en/configuration.file.php#configuration.file.scan)

until confusing and annoying, is the documented behavior... too bad now i don't know how to get the additional ini files purely with php functions (except "shell_exec()" maybe?)

</warning>
To Top