Home > Article > Backend Development > Analyze how to obtain the current running environment through PHP functions to determine the execution logic (tips)_PHP tutorial
Generally, our running environment is apache, of course some people use IIS environment
If we want to know what our current running environment is, then we only need to use the function php_sapi_name() to test
Perform comparison and judgment processing
Function: php_sapi_name();
The output result under the apache environment is "apache2handler";
In cgi mode The output result is "cgi-fcgi"
If it is run in command line mode, the output result is: "cli"