1

I am writing a Zend module. I have implemented this 2 functions:

   PHP_RINIT_FUNCTION
   PHP_RSHUTDOWN_FUNCTION

The first one in called when a request is made. The second is called for the response. I want to keep informations between the 2 functions. I have tried to create a global variable but this variable is shared for all the PHP module. So other requests car interfere with it.

How can i store information into variables between thoses functions. The scope of those variables is the life of ONE php request

Sunil Sharma
  • 2,653
  • 1
  • 25
  • 36
Bob5421
  • 7,757
  • 14
  • 81
  • 175
  • You can use a Zend Storage to do so. – Unex Jun 15 '16 at 16:18
  • Thanks can you tell me more ? How the variable scope could fit to request only – Bob5421 Jun 15 '16 at 16:34
  • You should check official documentation : http://framework.zend.com/manual/current/en/modules/zend.session.storage.html. All the answers to your need are here. Zend_Storage is used to built session in zf2 but you can also built custom storage. – Unex Jun 16 '16 at 08:25
  • I am writing an extension with C. I am not in PHP layer... – Bob5421 Jun 16 '16 at 11:21
  • Will a global variable be kept during the whole lifecycle? I've written several extensions but never used these hooks before so just a guess... – Frederick Zhang Oct 06 '16 at 14:35
  • In fact i want a variable which will Be alive during script exécution and not shared between other scripts – Bob5421 Oct 06 '16 at 15:41

0 Answers0