PHP commonly used to obtain apache information function

Source: Internet
Author: User
Keywords Network programming PHP tutorial
Tags apache array echo environment failed to function information name

* /
$ version = apache_get_version (); // Obtain the apache version and assign it to the variable
echo "$ version"; // output the result

$ server_ip = apache_getenv ("server_addr"); // Obtain the server's ip information by getting the environment variable function
Echo $ server_ip; / / output results

$ url_info = apache_lookup_uri ('2-1.php tutorial'); // execute request on url and return message
print_r ($ rul_info); // output the content of the result
if (file_exists ($ rul_info-> filename)) // if the result of the return value
{
echo 'file exists!'; / / output the corresponding content
}

apache_note ("name", "days of the soul"); / / Set the request record x name value
echo apache_note ("name"); / / Get the name of the request record in apache

$ headers = apache_request_headers (); // Get http request headers
foreach ($ headers as $ header => $ value) // Output the result array by looping
{
echo "$ header: $ value <br> n"; // Output array key / value pairs
}

$ result = apache_get_modules (); / / return apache loaded module list, and assigned to the variable
print_r ($ result); // Output the result array


if (apache_setenv ("example_var", "test_value")) // Set environment variables
{
echo "apache environment variable example_var set successfully!"; / / If the output is set successfully
}
else
{
Echo "apache environment variable example_var failed to set up!"; / / If output failed to set up
}

Related Article

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.