PDA

View Full Version : Access Apache Constants


ast3r3x
2007-06-05, 19:40
Ok, so I'm loads closer to creating the secure cookie protocol I've been working on implementing. However I was hoping some smarter people than myself here could help me. I need to access an apache constant through PHP, or Perl (but I'd have to get it back into PHP). Does anyone know how to do this?

I was wondering if you could do something like set a PHP variable from Apache. It looks like they are doing something like that here (http://us3.php.net/configuration.changes). If anyone has any ideas it would be greatly appreciated, I figure there should be a way to, but I am not sure exactly how you'd do it.

And sorry for filling the Programmer's Nook with a bunch of small questions, I hope that isn't too annoying. In the future I shouldn't have too many questions because I'm not dealing with stuff beyond my skill level.

Majost
2007-06-05, 20:16
Ok, so I'm loads closer to creating the secure cookie protocol I've been working on implementing. However I was hoping some smarter people than myself here could help me. I need to access an apache constant through PHP, or Perl (but I'd have to get it back into PHP). Does anyone know how to do this?

I was wondering if you could do something like set a PHP variable from Apache. It looks like they are doing something like that here (http://us3.php.net/configuration.changes). If anyone has any ideas it would be greatly appreciated, I figure there should be a way to, but I am not sure exactly how you'd do it.

And sorry for filling the Programmer's Nook with a bunch of small questions, I hope that isn't too annoying. In the future I shouldn't have too many questions because I'm not dealing with stuff beyond my skill level.

You can access all sorts of constants via the $_SERVER, and $_ENV (http://us3.php.net/manual/en/reserved.variables.php) variable arrays, among others. Is what you're looking for there?

ast3r3x
2007-06-05, 22:20
Nope. Sorry I forgot to specify what I'm looking for. With mod_ssl, SSL_SESSION_ID is a constant which is what I am trying to get, but I don't have mod_ssl installed on my server. Can someone verify that with mod_ssl turned on, I'd get more variables listed in $_SERVER or $_ENV? If so I'll request my host turn it on, but the chances of that probably aren't too good huh?

Majost
2007-06-05, 22:22
Why don't you just ask them? :p

ast3r3x
2007-06-05, 22:42
Why don't you just ask them? :p
Indeed, it looks like it might be possible to access it with $_SERVER if mod_ssl is installed. We'll see, but that could be amazing.

ast3r3x
2007-06-06, 06:07
You can't access it with PHP, however using .htaccess, and a little creative regular expressions, you can get it into PHP.