php ini file location code example

Example 1: To find out where your php.ini is located

run: php --ini

Example 2: php get file location

# C:\Users\Redacted\Desktop\main.php
include __DIR__ . DIRECTORY_SEPARATOR . 'include.php';
echoScriptPath();

# C:\Users\Redacted\Desktop\include.php
function echoScriptPath() {
    list($scriptPath) = get_included_files();
    echo 'The script being executed is ' . $scriptPath;
}

Example 3: where is php.ini file

#Here is the path of php.ini file 

C:\xampp\php\php.ini

#check in your system drive where the wamp or Xampp is install

Tags:

Misc Example