0

how to enable HTTP request header on Apache 2.4.46 with PHP-FPM 7.4

I'm unable to read custom http header, which run on local with Apache + mode_php

apache_request_headers();

is there any alternative or is there a way to enable it

Shareque
  • 129
  • 1
  • 9
  • 1
    Please provide why you are unable to do it. Are you facing any error? If so please post the error you get and some code around this line – Siddharth Agrawal Mar 13 '21 at 06:15
  • okay resolved now, is it correct way – Shareque Mar 13 '21 at 12:46
  • 1
    I can't find a duplicate question covering this properly, but it sounds like you're issue is not with apache_request_headers() in general, but with a particular header which has an underscore in its name. These are problematic because of the way headers map to environment variables in the CGI standard, so are dropped by default. – IMSoP Mar 13 '21 at 13:55

1 Answers1

0

okay I got like this I have change request header X_PJAX from dash to underscore

add this in .htacess file

RewriteRule .* - [E=HTTP_X_PJAX:%{HTTP:X_PJAX}]

and then access with prefix HTTP

$_SERVER["HTTP_X_PJAX"];
Shareque
  • 129
  • 1
  • 9