Somk
Somk

Reputation: 12047

Get PHP INI File

Is there a way to use something like

ini_get_all()

And output to the screen what the .ini file actually looks like. I mean so you can copy and paste it. This is because I cannot actually access the hosts .ini but can make my own. But when I make my own it loses all of the current settings so I need to know how it is setup currently.

Upvotes: 2

Views: 313

Answers (1)

slash28cu
slash28cu

Reputation: 1634

Try this:

echo file_get_contents(php_ini_loaded_file());

You can also check if your php is loading any additional .ini file aside of the main php.ini.

//This will return you a comma separated list of the additional ini files loaded
    $additional_ini_files = php_ini_scanned_files();

    // The explode and the str_replace is for removing the new line char from the strings
    foreach(explode(",\n",$additional_ini_files) as $ini_file_path){ 

          echo file_get_contents(str_replace("\n","",$ini_file_path)); 

    }

Upvotes: 8

Related Questions