GoAdmio

session

Create the PHP session folders for every PHP version and make them writable by all accounts (also sets the modes of the MySQL client configuration files)

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

PHP keeps a small file for every visitor who is logged in to a site. These session files live in a folder on the server. If that folder is missing or PHP isn't allowed to write to it, sites show errors such as:

session_start(): open(/var/lib/php/session/sess_abc123, O_RDWR) failed: Permission denied

Visitors then can't stay logged in, and login pages keep returning to the login form.

/go/session fixes this. It creates the session folders that GoAdmio's PHP versions use and sets them so that any account can write to them. It also sets the mode of /etc/my.cnf and /root/.my.cnf.

The command is safe to run again. update runs it as part of every update.

[!WARNING] The modes the command sets are very open. See Security notes.


Quick start

/go/session

Syntax

/go/session

The command takes no arguments.


Options

None.


Output

The command prints nothing. Every run is logged to /var/log/go/session.log with a timestamp and the arguments used.


Examples

# Create the folders and set their permissions
/go/session
# Check one of the folders
ls -ld /var/lib/php/session
# Find out which folder a PHP version really uses
php -i | grep session.save_path

Troubleshooting

Symptom Likely cause Fix
Session errors continue after running the command The site uses a session folder that isn't in the list below. Find the real folder with php -i | grep session.save_path, then create it and make it writable.
Visitors are logged out or the folder is full of old files Old session files aren't deleted by this command. See clearsession. It deletes every session file, so every visitor is logged out.
A security scan reports that /tmp has lost its sticky bit The command sets /tmp to mode 777. Run chmod 1777 /tmp. The next run of session sets it back.
A security scan reports that /root/.my.cnf is readable by everyone The command sets it to mode 755. Run chmod 600 /root/.my.cnf. The next run sets it back.
Folders exist for PHP versions that aren't installed The command creates folders for all versions in its list. This is harmless.

Details

Folders created

The command creates each of these (if it is missing) and sets it to mode 777:

Folder Notes
/tmp Already exists. Only the mode is changed.
/var/lib/php/session, /var/lib/php/sessions The default folders on AlmaLinux (and related systems) and on Debian and Ubuntu.
/var/lib/<version>/session For 5.6, 7.0 to 7.4, and 8.0 to 8.5. For example /var/lib/8.3/session.
/var/lib/php<NN>/session For php56, php70 to php74, and php80 to php85. For example /var/lib/php83/session.

Configuration files

/etc/my.cnf and /root/.my.cnf are set to mode 755. These are the MySQL/MariaDB client configuration files, and /root/.my.cnf normally holds the database root password.

Security notes

Item Used for
/etc/my.cnf, /root/.my.cnf The MySQL/MariaDB client configuration.
/var/log/go/session.log The command log.

See also

Command Description
clearsession Delete every active PHP session file from the server
fix Fix GoAdmio file and folder permissions
multiphp Manage PHP versions per domain
installphp Install a different PHP version on GoAdmio
fpm Restart all installed PHP-FPM versions on your server
update Update GoAdmio to the latest version via the command line
my Optimize the my.cnf configuration for MySQL/MariaDB