0

This works

apache_setenv('sessionID', session_id(), TRUE)

BUT

it only makes sessionID appear on GETs of PHP files which set the variable. I would like the sessionID to appear on all GETs including js, jpg, gif etc referred from the PHP file. i.e. all the files in the PHP file. I thought that by setting an apache environment variable the variable scope would make it available for every GET from the PHP file.

Is there any way to do this ?

p.s. I tried setting apache note first and that returns exactly the same.

RobC
  • 45
  • 8
  • how are you accessing the session variable set each time a get request is made ??? – dreamweiver Jun 03 '14 at 06:54
  • the only place I'm using it is in my httpd.conf in the logformat as %{sessionID}e – RobC Jun 03 '14 at 06:57
  • refer to this ,http://stackoverflow.com/questions/4684655/is-it-possible-to-use-variables-in-httpd-conf. i think you need to set the environment variable before the server starts as mentioned by `noodl` in this SO Answer – dreamweiver Jun 03 '14 at 07:07
  • that doesn't work. defining the env varaible in httpd.conf sets the value you give it and that value shows in log but it isn't updated by apache_setenv in apache. Again only the php file which calls apache_setenv shows the session_id. – RobC Jun 03 '14 at 07:51
  • resolved. I used the content of the session cookie instead which in my case is the sessionID only. There is already an apache log option for this. %{cookiename}C – RobC Jun 03 '14 at 09:15
  • good to know that, now lets close this question with a self answer – dreamweiver Jun 03 '14 at 09:30
  • spoke too soon, now first get of the php file doesn't have the sessesionID in it. Everything else does except favicon. Any more suggestions? – RobC Jun 03 '14 at 10:10

0 Answers0