How to allow single user to access different pages of same website in single browser?

Dear coders,

I am trying to achieve this because I am running an import file function at below URL using AJAX. It will take 15 mins or more to complete the insertion of data.

Chrome Browser:
[Tab 1] https://example.com/controller/import-file

I want to see the log I have added in DB using Yii2 Logger on the second tab.
[Tab 2] https://example.com/controller/view-log

While the TAB 1 process runs, the second tab log is not loading the data; instead, it is just waiting for tab 1 request to get completed.

I am running Yii2 in Amazon EC2.

Is there anything I have to do with MPM_Worker or MPM_Prefork or MPM_Events? If yes, kindly guide.

I refer this guide: https://www.linode.com/docs/guides/tuning-your-apache-server/

Thank you.

That sounds like blocking in standard PHP sessions. Try switching to Redis for sessions.

Any guide to implementing Redis in Yii2? First time I heard this

Will it affect the login functionality?

The real case is as below:
User Logged in to Account > Import Data > Fetch using APIs > Script will add logs in database > In a new tab of the same browser > user can see the logs or can perform any other action.

https://www.yiiframework.com/extension/yiisoft/yii2-redis/doc/api/2.0/yii-redis-session

1 Like

Any other solution except manipulating session? I tried to implement it, but it broke the system so any Apache or PHP configuration would be a nice option.

Yes, could be done from php.ini: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-redis-server-as-a-session-handler-for-php-on-ubuntu-14-04

1 Like

@samdark Thank you so much for guidance. I have successfully achieved it.

If anyone wants to know:

  • Install Redis-Server in your webserver, using digitalocean link or for AWS EC2

  • Install PHP Redis extension. AWS Guide

  • Apply session.save_path & session.save_handler in php.ini

  • Restart the server

  • Apply Redis session in Yii2 Component as said here

Bingo :+1:

1 Like

Refer to this article to add ElastiCache Redis to Yii2

How to install/use AWS:ElastiCache Redis session for Yii2