0

Given is a Unix environment with Apache 2.4.29 and PHP 7.1.13 running as an Apache module.

I have a .shtml file which performs SSI virtual includes of other resources. Two of them are PHP scripts. The first scripts performs some action, and the second scripts outputs data. I cannot change this structure. Now I want to pass data from script1 to script2. My first guess was to use PHP with apache_setenv in script1 and apache_getenv in script2. Unfortunately script2 cannot see the new environment entries created in script1. Then I tried apache_note(), which gives the same negative effect.

I am wondering if PHP is working well with such an SSI environment. Using <!--#set var="variable" value="value"--> in .shtml files makes variable variable available for all following include virtual calls. But PHP denies this, at least in my setup. Any suggestions? Thanks in advance!

Mirko Sertic
  • 368
  • 3
  • 7

1 Answers1

1

SSI environment

There's no such thing as "SSI environment". It's just a httpd feature.

Now I want to pass data from script1 to script2

If both talk to remote http client you can try to use session for this. If not, then you can always save temporary file in script1 (i.e. JSON, or serialized data) and read in script2.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • Thanks for the quick reply. The temp file options is indeed the only one working for me at the moment. But if there is an option to avoid creating temporary files for a single request I'd like to chose this one to reduce system load. – Mirko Sertic Jan 30 '18 at 15:50
  • what about using tmpfs or memcached to store your data in the memory? – Marcin Orlowski Jan 30 '18 at 15:52