Hi, connecting a secondary computer via LAN and opening the application via browser neither cookies nor sessions work, I can’t use the exe functions because the sessions must be different as well as the cookies, a login made in the main computer must be different from the secondary computer. So I would like to save cookies and sessions inside the PC that is using them.
How should I do it?
It doesn’t give me any errors, simply on the secondary computer it doesn’t save and doesn’t read the sessions.
Sure, session and cookies are saved by PHP locally, so since the EXE is running on one computer, they will be stored in the same location for all PCs calling the EXE as a server.
A possible solution is to generate a unique session ID for each computer accessing the application. This way, sessions will not conflict between the main and secondary computers. You can modify your PHP code to ensure that each client has a unique session by using:
session_id(uniqid());
session_start();
Or try this:
session_set_cookie_params([
'lifetime' => 0, // Session cookies only last for the session
'path' => '/',
'domain' => '', // Set to an empty string to make it machine-specific
'secure' => false,
'httponly' => true
]);
session_start();
it’s fine to avoid conflicts very useful, the problem is that it doesn’t read the sessions at all. Maybe I have to put a relative path to save the session file? Is there a feature to set or do I have to change for example the session.save_path? In this case however I don’t know what path to insert.
Thanks.
To explain myself well on secondary computers if I do var_dump($_SESSION) the result is an empty array
You also have options for session defined in PHP.INI. Can you please check if some options could be useful to your problem?
Anyway, we’ll test ourselves the var_dump($_SESSION) code and see what could be the reason.
I did some tests both on the php.ini file and in the code via php by setting different paths for saving sessions, but if I understood the problem could be the absolute path that does not work starting from the web browser, maybe a relative path would be needed that works both from the EXE and the browser, but I did not find a way.
From bowser it does not read the saved sessions, if the reason is not the path maybe it could be some setting that I did not understand.
Thanks
We will deliver our program shortly. There will be over 150 installations with around 1000 users. There are still a few small problems that may also come from our PHP framework dbXapp. Sometimes in a $_GET there is a key with a ‘?’ at the beginning.
I’m testing it but everything seems to work.
I see a difference that it didn’t make before.
By scanning files inside a folder
$lista=glod($path)
foreach($lista as $value){
etc…
}
In the exe version the scan is very slow, while in the browser version it is fast.
Just for information I can solve it without problems, but maybe it could interest you.
Thanks
Some PHP extensions require additional DLLs (dependencies), generally available in the “PHPRuntimeXX” subfolder of ExeOutput. When you compile the DLL into the EXE file, ExeOutput includes the dependencies automatically. But not when you use external DLL files.
Yes, it’s a feature on our TODO list. We already implemented relative paths in HTML Executable, so they will come into ExeOutput too.