Is there a way to set a custom variable from within .htaccess so that every php script can then read from it ? I went googling around nothing.
Thankyou!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can only set an environment variable from .htaccess:
And this becomes available in the
$_SERVERarray:So, not exactly a global variable. But still useful for some purposes.
(The other option is declaring an
auto_prepend_fileto pre-define variables. But that’s more a workaround then.)