• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

CageFS + php /var/lib/php/session/ + Custom php.ini

Andriy_Martynyuk

New Pleskian
Hi ppl,
while using the code similar to:
PHP:
<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<html>
<body>

<?php
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat";
echo "Session variables are set.";
?>

<br>

<?php
// Echo session variables that were set on previous page
echo "Favorite color is " . $_SESSION["favcolor"] . ".<br>";
echo "Favorite animal is " . $_SESSION["favanimal"] . ".";
?>

</body>
</html>
We get error:
Code:
Warning: session_start(): open(/var/lib/php/session/sess_n02m5jb0ipntqj3pvn14hebfg6, O_RDWR) failed: No such file or directory (2) in /DATA/www/<domain>/httpdocs/login/check_login.php on line 7 Notice: Undefined index: currentPage in /DATA/www/<domain>/httpdocs/login/check_login.php on line 48 Warning: Unknown: open(/var/lib/php/session/sess_n02m5jb0ipntqj3pvn14hebfg6, O_RDWR) failed: No suc h file or directory (2) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0
The error appears until we disable CageFS for this domain.

So we try to set a "session.save_path" variable wia plesk admin but php_info still shows session.save_path is (/var/lib/php/session). Will provide any additional info necessary.

Please help.
 
Hello Andriy,

You seem to run PHP as an Apache module and not as CGI or FastCGI. This is why the settings are not taking effect..
To make changes with PHP as an Apache module, you will need to edit the file
Code:
/etc/httpd/conf/httpd.conf
and the restart the webserver.

Hope that helps ...
 
Ok, I think I found the issue, it seems it's cloudlinux issue:
when cagefs is enabled the site has no access to "/DATA/www/system/<domain>/etc/php.ini" so uses default /etc/php.ini
That causes the wrong session folder used.
But strange why not using /DATA/www/<domain>/etc/php.ini or /DATA/www/<domain>/conf/php.ini as it is instructed in manuals

Maybe someone knows how to fix?
 
Last edited:
Back
Top