• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP Opcache with user session

#1
Question 
Hi,

I just read about PHP Opcache today but I just wondered if it's possible to use Opcache on Codeigniter 4 with user session. I tried to enable opcache on my codeigniter 3.x app however a lot of users where able to access session information that belongs to other user.

Also, how to I remove the cache if I updated my code specially in production?

If Opcache with user session is not possible, what would be the most basic alternative? I just wanted to speed up the bootstrap time of codeigniter or the app itself.

Thanks!
Reply

#2
Opcache does not affect session data in any way. If Opcache interfered with sessions nobody would use it. Everybody uses Opcache.

Opcache checks files for the last time it was modified on disk and rebuilds the cache if the file has changed since the last cache build. There is a php.ini setting that can disable this file checking. If that setting is used, and lots of people do disable checking in a production environment, you will have to force a cache rebuild.

Restarting the http server (Apache, or other) is one way to force an Opcache rebuild. Calling opcache_reset() is another way. But that cannot be called through the CLI so you would need to add a special endpoint to your application and secure it somehow. In other words, this is a backend/admin task.

There are a few Opcache management GUIs available. Google can help you find them.
Reply

#3
Thank you for your help. I was able to enable it on my production server. I noticed a bit speed improvements.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.