Php common functions for obtaining apache server information php code
Common functions of php to obtain APACHE information */$ version = apache_get_version (); // Obtain the APACHE version and assign it to the variable echo "$ version "; // output result $ server_ip = apache_getenv ("server_addr"); // Obtain the server ip information by using the environment variable function echo $ server_ip; // output result $ url_info = apache_lookup_uri ('2-1. php Tutorial '); // execute the request to the url and return the information print_r ($ rul_info); // output the result content if (file_exists ($ rul_info-> filename )) // if the returned result has a value {echo 'file exists! '; // Output the corresponding content} apache_note ("name", "awesome"); // Set the name value in the apache request record to echo apache_note ("name "); // Obtain the name value in the apache request record $ headers = apache_request_headers (); // Obtain the http request header foreach ($ headers as $ header => $ value) // use the loop output result array {echo "$ header: $ value n"; // output the array key/value pair} $ result = apache_get_modules (); // return the list of modules loaded by apache and assign the value to the variable print_r ($ result); // output result array if (apache_setenv ("example_var", "test_value ")) // Set the environment variable {echo "to apa Che environment variable example_var set successfully! "; // If the output content is set successfully} else {echo" failed to set the apache environment variable example_var! "; // If the output fails to be set}
This article is provided by PHP Chinese network. I hope this article will help you learn APACHE and continue to pay attention to PHP Chinese network!