Page 1 of 2
Sessions on XAMPP no go, Live ok.[Headache]
Posted: Sun Nov 03, 2019 4:02 pm
by sphere
Hi,
this piece of an .lc file works ok on real server but not local on XAMPP
Code: Select all
<?lc
set the sessionSavePath to the defaultfolder
set the sessionLifetime to 1800
set the sessionCookieName to "LCTESTCOOKIE"
set the sessionID to "SessionTestIdentifier"
start session
--empty when return to page
if $_SESSION["place"] is not empty then
put empty into $_SESSION["place"]
end if
if $_SESSION["name"] is not empty then
put empty into $_SESSION["name"]
end if
stop session
?>
on XAMMP it gives an error in the browser like:
file "D:/server/xampp/htdocs/testlc/lc_place.lc"
row 8, col 1:
and as i read in a few messages on the list and on the forum here, it is probably that a folder is not existing or it has no rights to write there.
I also tried this: set the sessionSavePath to "/sessiontemp" , an extra created folder with the correct rights but no go.
Also tried the complete path like: D:/server/xampp/htdocs/testlc/sessiontemp
Anyone know how to fix this in XAMPP so i can develop LOCAL instead of on live server?
Thanks a lot!
Re: Sessions on XAMPP no go, Live ok.
Posted: Sun Nov 03, 2019 11:29 pm
by ghettocottage
have you tried (just for debugging) to set the folder permissions to 777, or whatever the windows equivalent of the is (writable by everyone)
Re: Sessions on XAMPP no go, Live ok.
Posted: Sun Nov 03, 2019 11:31 pm
by [-hh]
On most OS opening a local file with a browser doesn't work any more.
You have to put the file into htdocs (=your web folder) or a 755 folder of htdocs and call it as webpath.
Say 8080 is the port at which XAMPP listens and "localhost:8080" is the serverName, then "/" is the top of the webpath, replacing "D:/server/xampp/htdocs/" in your case.
In sum, you could try as URL: localhost:8080/testlc/lc_place.lc
You can change the port and serverName in the XAMPP control panel in "Config Apache (httpd.conf)".
Of course XAMPP should be configured (as the remote server is) to run LC Server.
Re: Sessions on XAMPP no go, Live ok.
Posted: Mon Nov 04, 2019 1:39 pm
by sphere
Thanks.
Yes the folder is write-able for everyone.
lc_place.lc is located in the folder testlc under htdocs in XAMPP.
The URL in the browser which i open is localhost:80/testlc/lc_place.lc
The error is then displayed in the browser screen.
row8 column1 is where the command start session resides.
Maybe it is a rights issue, but maybe one that xampp when running does not see as it's own, although when checking in windows it is writable.
Will google a bit.
Re: Sessions on XAMPP no go, Live ok.
Posted: Mon Nov 04, 2019 3:03 pm
by sphere
Just tried it on another PC there the defaultFolder worked right away.
Added another folder to store the sessions and got the same error.
Now i checked the permission of this folder and changed it for the current user
And added this in the lc_place.lc file
set the sessionSavePath to "C:/Portable/xampp/htdocs/lc/session"
And it works!
Is it correct that this is neccessary in each file or only the first time, say with the index.lc page?:
Code: Select all
<?lc
set the sessionSavePath to "C:/Portable/xampp/htdocs/lc/session"
set the sessionLifetime to 1800
set the sessionCookieName to "LCTESTCOOKIE"
set the sessionID to "SessionTestIdentifier"
Thanks!
Re: Sessions on XAMPP no go, Live ok.
Posted: Mon Nov 04, 2019 4:34 pm
by FourthWorld
sphere wrote: ↑Mon Nov 04, 2019 3:03 pm
Is it correct that this is neccessary in each file or only the first time, say with the index.lc page?:
Code: Select all
<?lc
set the sessionSavePath to "C:/Portable/xampp/htdocs/lc/session"
set the sessionLifetime to 1800
set the sessionCookieName to "LCTESTCOOKIE"
set the sessionID to "SessionTestIdentifier"
A CGI is initialized, runs, and terminates with reach HTTP request. Any changes to global properties will die along with the process.
Within a given request, you should only need to set that path once, no matter how many other scripts are invoked before the process dies.
But you will want to have any initialization your scripts need performed with each request.
Re: Sessions on XAMPP no go, Live ok.
Posted: Mon Nov 04, 2019 6:34 pm
by sphere
Ok thank you Richard.
Re: Sessions on XAMPP no go, Live ok.
Posted: Tue Nov 05, 2019 9:44 pm
by sphere
Very strange, yesterday sessions on localhost worked, today not. Nothing has changed.
On live host still working. Can't comprehend...
Re: Sessions on XAMPP no go, Live ok.
Posted: Wed Nov 06, 2019 4:07 am
by ghettocottage
A raspberry pi with Ubuntu 18.04 server would make a nice little LC Server Development Box:
https://www.adafruit.com/product/4295?src=raspberrypi
Re: Sessions on XAMPP no go, Live ok.
Posted: Wed Nov 06, 2019 7:50 am
by mrcoollion
One can also use uWAMP for Windows which is a free Wamp Server with Apache MySQL PHP and SQLite.
It works really easy because it is a portable version that needs no installation and has a nice startup interface. I used it e.g. to test OpenSource iTOP ITSM Software and it runs excellent.
Info at:
https://www.uwamp.com/en/
Download url
https://www.uwamp.com/en/?page=download
Unzip/URAR or install (depends on what package you downloaded) and run UwAmp.exe (use admin privileges to be sure).
place your web app in the .../www/my-app/ folder.
use the UwAmp interface for setting up PHP and MySQL.
IMPORTANT Prerequisites !!
Before using UwAmp you must install Visual C++ Redistributable x86 version vc_redist.x86.exe. This is a PHP requirement.
This is also available at
https://www.uwamp.com/en/?page=download
Regards,
Paul
Re: Sessions on XAMPP no go, Live ok.
Posted: Wed Nov 06, 2019 9:22 am
by sphere
Would a raspberry be faster then the VPS i now run?
It works ok on VPS just not on Localhost, but indeed i could use it as fake (real) server.
I will take a look at WAMP, previously i used EasyPHP, also a nice package and in the past i installed all module one by one on windows. But a single install is easier.
I'm now rewriting the PHP pages i have working to LC.
I also had the idea to just use the existing PHP pages and use only the last page with LC-server. But probably this is more difficult the to use first sessions from PHP and then switch to LC.
For now i need to get this sessions running stable so i can continue develop LOCAL instead of uploading each adjustment to the live server and test there.
Thanks for your suggestions.
Re: Sessions on XAMPP no go, Live ok.
Posted: Wed Nov 06, 2019 4:40 pm
by ghettocottage
Would a raspberry be faster then the VPS i now run?
Most likely, with the added benefit of being an always-on local server that could be used for other various tasks or projects (plex server, file server, etc)
Re: Sessions on XAMPP no go, Live ok.
Posted: Wed Nov 06, 2019 5:49 pm
by FourthWorld
Is your VPS running Windows or Linux?
Re: Sessions on XAMPP no go, Live ok.
Posted: Wed Nov 06, 2019 6:14 pm
by sphere
Thanks gettocottage will think about it.
It's a starters vps with just one core and 50GB. I have Linux running ubuntu 18.04.
And for dev localhost i use Xampp on Windows.
Re: Sessions on XAMPP no go, Live ok.
Posted: Wed Nov 06, 2019 6:30 pm
by FourthWorld
Even if you use Windows for development, one nice thing about ghettocottage's suggestion of having a cheap local Linux server is it provides a staging server that more closely mirrors your production server.
You don't want to discover something like a case sensitivity issue in production.
You can set up shared ssh keys and use rsync to push from that staging server to the production server, faster and less error-prone than manual updates.
Bonus that you can also put it to use providing other services for your local network. I use one here with Nextcloud to keep my LC plugins and client work files in sync across the machines I develope and test on, and in its spare time it gathers and packages up the various data sources displayed in LiveNet.
Small cheap machines like nettops or Pi are great for always-on services because they consume just pennies' of electricity over the course of a year. And they're fun.
