Common functions for php to obtain apache server information-PHP source code

Source: Internet
Author: User
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!

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.