Xampp new installation and PHP session errors

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Xampp new installation and PHP session errors

Postby tiancris » 28. October 2023 23:28

Hello! I'am a xampp user since many years ago, never had a problem I couldn't resolve. Until now... :mrgreen:

I installed a new disk on my computer, previously I had a HDD with Windows 10, now a SDD with Windows 11.

Since I still need PHP 5 for some of my works, I installed XAMPP with this file:
xampp-windows-x64-5.6.40-1-VC11-installer.exe

I installed it on this directory:
C:\xampp-5

After the installation, I edited these files to add the virtual hosts I need:
C:\xampp-5\apache\conf\httpd.conf
C:\xampp-5\apache\conf\extra\httpd-vhosts.conf

I started Xampp Control and then executed Apache and MySQL, and everything seemed to be ok. My site web was working... until I tried to use a login form. After entering user and password the login was not working.

From Xampp Control I opened Apache "error.log" and I found these messages:

Code: Select all
[Sat Oct 28 18:57:14.157306 2023] [:error] [pid 14808:tid 1912] [client 127.0.0.1:61000] PHP Warning:  session_start(): open(/var/cpanel/php/sessions/ea-php55\\sess_e5uk2qaeu9une9tim8asfir305, O_RDWR) failed: No such file or directory (2) in C:\\xampp-5\\htdocs\\prueba\\admin\\users\\login-form.php on line 2, referer: http://prueba.localhost/admin/users/login-form.php

[Sat Oct 28 18:57:14.157306 2023] [:error] [pid 14808:tid 1912] [client 127.0.0.1:61000] PHP Warning:  Unknown: open(/var/cpanel/php/sessions/ea-php55\\sess_e5uk2qaeu9une9tim8asfir305, O_RDWR) failed: No such file or directory (2) in Unknown on line 0, referer: http://prueba.localhost/admin/users/login-form.php

[Sat Oct 28 18:57:14.157306 2023] [:error] [pid 14808:tid 1912] [client 127.0.0.1:61000] PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/cpanel/php/sessions/ea-php55) in Unknown on line 0, referer: http://prueba.localhost/admin/users/login-form.php


From Xampp Control I opened "php.ini" and the value of session.save_path is correct:
session.save_path="C:\xampp-5\tmp"

My guess is that somewhere there is some configuration trying to use this non existant directory "/var/cpanel/php/sessions/ea-php55" but I don't know where to look.

Any idea? :?:

Thanks in advance!
tiancris
 
Posts: 3
Joined: 28. October 2023 22:46
XAMPP version: 8
Operating System: windows 11

Re: Xampp new installation and PHP session errors

Postby tiancris » 29. October 2023 03:53

Well... just in case you feel curious, I still don't know what is happening, but I fixed it just by creating the directory "C:\var\cpanel\php\sessions\ea-php55". Now PHP session files are being created there despite the value defined in php.ini :?

I would love to understand why though :mrgreen:
tiancris
 
Posts: 3
Joined: 28. October 2023 22:46
XAMPP version: 8
Operating System: windows 11

Re: Xampp new installation and PHP session errors

Postby tiancris » 29. October 2023 15:35

I know what you are thinking... "not this guy again". But bear with me, because there is wisdom in my words (almost).

If you, like me, still have some web sites not managed with GIT and when you buy a new disk you have to download via FTP right from the server, pay attention to some funny files which you could find there.

I didn't know some hosting services could add a personalized "php.ini" in the root of your website with custom values you never have set neither expected. And not only that, they also modify your own ".htaccess" file with more code you aren't aware of. That's where I found the strange values my website was trying to use on my local machine.

So, TL;DR:
Delete any "php.ini" file you didn't put it in your website, and look for modifications on ".htaccess" file you didn't make.

And one more advice: don't try to resolve this kind of things with your body low on caffeine :oops: . And use GIT. And XAMPP, of course.
tiancris
 
Posts: 3
Joined: 28. October 2023 22:46
XAMPP version: 8
Operating System: windows 11


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 217 guests