The solution to the invalidation of PHP's getallheaders function under Nginx

Source: Internet
Author: User
Tags apache php

Today, Apache PHP application deployed to the Nginx, but found that the error: getallheaders () This function is not found.

It's amazing, this is not the default PHP function, how can I find it. But the problem is that there is only one way to find a solution.

Originally this function is the alias of the Apache_request_headers () function, see, with Apache pedigree, so nginx can not be used very normal.

Find the reason, or need a solution, in the PHP manual found the function of the writing, so excerpt down, convenient to view later:

<?phpIf(!Function_exists(' Getallheaders ')){functionGetallheaders(){Foreach($_serverAs$name=$value){If(Substr($name,0,5)==' Http_ ') { $headers [str_replace ( " '-' ucwords< Span class= "P" > (strtolower (str_replace substr ( Span Class= "NV" > $name 5=  $value } } return  $headers }}             /span>                

Workaround for PHP's getallheaders function to fail under Nginx

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.