How to use PHP & ENV Method (Environment Variables) ($_ENV) Learn PHP how to using ENV (Environment Variables) and read a php variable from $_ENVĀ .
ShotDev Focus:
- Using PHP & $_ENV (Environment Variables)
Example
php_env.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <?php echo "\$_ENV[\"ALLUSERSPROFILE\"] = ".$_ENV["ALLUSERSPROFILE"]."<br>"; echo "\$_ENV[\"CommonProgramFiles\"] = ".$_ENV["CommonProgramFiles"]."<br>"; echo "\$_ENV[\"COMPUTERNAME\"] = ".$_ENV["COMPUTERNAME"]."<br>"; echo "\$_ENV[\"ComSpec\"] = ".$_ENV["ComSpec"]."<br>"; echo "\$_ENV[\"DEFLOGDIR\"] = ".$_ENV["DEFLOGDIR"]."<br>"; echo "\$_ENV[\"FP_NO_HOST_CHECK\"] = ".$_ENV["FP_NO_HOST_CHECK"]."<br>"; echo "\$_ENV[\"NUMBER_OF_PROCESSORS\"] = ".$_ENV["NUMBER_OF_PROCESSORS"]."<br>"; echo "\$_ENV[\"OS\"] = ".$_ENV["OS"]."<br>"; echo "\$_ENV[\"Path\"] = ".$_ENV["Path"]."<br>"; echo "\$_ENV[\"PATHEXT\"] = ".$_ENV["PATHEXT"]."<br>"; echo "\$_ENV[\"PROCESSOR_ARCHITECTURE\"] = ".$_ENV["PROCESSOR_ARCHITECTURE"]."<br>"; echo "\$_ENV[\"PROCESSOR_IDENTIFIER\"] = ".$_ENV["PROCESSOR_IDENTIFIER"]."<br>"; echo "\$_ENV[\"PROCESSOR_LEVEL\"] = ".$_ENV["PROCESSOR_LEVEL"]."<br>"; echo "\$_ENV[\"PROCESSOR_REVISION\"] = ".$_ENV["PROCESSOR_REVISION"]."<br>"; echo "\$_ENV[\"ProgramFiles\"] = ".$_ENV["ProgramFiles"]."<br>"; echo "\$_ENV[\"SystemDrive\"] = ".$_ENV["SystemDrive"]."<br>"; echo "\$_ENV[\"SystemRoot\"] = ".$_ENV["SystemRoot"]."<br>"; echo "\$_ENV[\"TEMP\"] = ".$_ENV["TEMP"]."<br>"; echo "\$_ENV[\"TMP\"] = ".$_ENV["TMP"]."<br>"; echo "\$_ENV[\"USERPROFILE\"] = ".$_ENV["USERPROFILE"]."<br>"; echo "\$_ENV[\"VSEDEFLOGDIR\"] = ".$_ENV["VSEDEFLOGDIR"]."<br>"; echo "\$_ENV[\"windir\"] = ".$_ENV["windir"]."<br>"; echo "\$_ENV[\"AP_PARENT_PID\"] = ".$_ENV["AP_PARENT_PID"]."<br>"; ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_env.php
Screenshot
.
.
.
3twenty-third…
…