Common functions for php to obtain apache information

Source: Internet
Author: User
Tags http request php tutorial

*/
$ 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 address through the environment variable function.
Echo $ server_ip; // output result

$ Url_info = apache_lookup_uri ('2-1. php Tutorial '); // execute a request on the url and return information
Print_r ($ rul_info); // output 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", "Heaven wins"); // Set the name value in the apache request record
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) // output the result array through loop
{
Echo "$ header: $ value <br> n"; // output array key/value pair
}

$ Result = apache_get_modules (); // return the list of modules loaded by apache and assign values to the variables.
Print_r ($ result); // output result array


If (apache_setenv ("example_var", "test_value") // sets the environment variable
{
Echo "the apache environment variable example_var is set successfully! "; // If the output content is set successfully
}
Else
{
Echo "failed to set apache environment variable example_var! "; // Output content if the setting fails
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.