Moving SuiteCRM sessions to a custom directory

SuiteCRM 8 stores PHP sessions in a location you can move for storage, security or hosting reasons. This page explains the two configuration paths, garbage collection, cache clearing and permissions.

On this page

Why teams move SuiteCRM session storage to a custom directory

Moving SuiteCRM session storage changes where PHP keeps the files that track each logged-in user, and it is a configuration change with permission and cache consequences. Teams usually make the move because the default session path sits on a disk that fills up, shares a volume with other services that compete for space, or sits in a location the web server user cannot control cleanly. Once the path changes, the web server user must be able to write to the new directory, and any cached configuration must be cleared before the change takes effect, so a change that looks finished can still be ignored until those steps are done.

The move is most often justified in three situations: multi-tenant hosts where several applications share one server and need separate session locations, dedicated volumes where session data should sit on storage sized and monitored for it, and hardened hosts where a team wants session files in a restricted path with tight ownership and no access from other accounts. Session data holds logged-in state, so whoever can read or write that directory can potentially act as a signed-in user. The location is therefore a security decision as well as a capacity one, and it should be reviewed alongside the controls covered in the security section of this page.

Before you change anything, confirm which SuiteCRM 8 version and PHP version your instance runs, since the configuration keys for session handling are set in different places depending on the install, and check the SuiteCRM 8 compatibility matrix for the supported PHP line. Then decide who owns the new directory, which account the web server runs as, and how you will confirm the change worked on staging before production. Ask your team to record the current session path and its permissions so a rollback is a single step rather than a guess.

Which configuration path fits your SuiteCRM 8 install

Start by confirming which SuiteCRM line you run and how it was installed, because the setting you change depends on that. Check the version in the admin console, then review the compatibility matrix for the PHP and web server stack. Find the configuration files your install actually loads, and record the result before you touch any file.

  • Version line: Note whether the instance is SuiteCRM 8.x or 7.x, using the exact release number shown in the admin console.
  • Installation method: Record whether the install came from a command-line install, a package or a container image, since file locations differ.
  • Web server user: Identify the user that PHP and the web server run as, because the session directory must be writable by that user.
  • PHP version: Confirm your PHP version against the SuiteCRM 8 compatibility matrix before changing runtime settings.

Check these items against your change record before choosing a configuration path.

Session storage options and when each fits

This table compares four places SuiteCRM 8 sessions can live: the PHP default path, the legacy session_dir setting, the Symfony framework.yaml settings, and a dedicated or shared mount. Read each row for its fit, the permission the web server user needs and the main risk. The key takeaway is that a custom path works only when the setting is read, the directory is writable by the right user and caches are cleared, so confirm all three on staging first.

OptionFitPermission requirementMain risk
Default PHP session pathSingle server with no custom storage need; the simplest option to keep as isWeb server user can write the path PHP reports as session.save_pathPath may sit on a small system partition or be affected by OS cleanup jobs
session_dir in the legacy configSingle server where the legacy setting is still the team's reference pointWeb server user can read and write the directory; recheck ownership after each deployConfirm your SuiteCRM 8 build reads the key, or sessions stay in the default path
framework.yaml session settingsSuiteCRM 8 installs where the team already manages Symfony configurationWeb server user can write the target path; clear the cache so the change appliesA change without a cache clear looks ineffective, and a bad path can block logins
Dedicated volumeOne or a few web nodes where sessions should be sized and isolated apart from the app treeSame owner and mode on every node; mount is present before PHP startsFull volume stops logins; a missing mount at boot can cause failures or fallback to another path
Shared mount across web nodesSeveral web nodes behind a load balancer that does not pin each user to one nodeIdentical path and write access on every node, with the same user IDLock contention, latency and stale session files under load; test the mount type before use
Garbage collection on any custom pathApplies to every option above once sessions leave the default pathConfirm the PHP session garbage collection settings still run against the custom pathOld session files accumulate if collection covers only the default location

How to change the session directory safely

This sequence moves SuiteCRM 8 session storage to a directory you control, with a tested path back if anything fails. Each change is backed up, staged, verified and checked before the next one starts. The result is a documented session location that users can sign in against and that operations can roll back.

  1. Back up configuration and take a staging copy

    The administrator copies the legacy configuration file and the Symfony framework configuration file, then takes a full file and database backup of the production instance. The same backup is restored to a staging copy of the same SuiteCRM 8 version, where every later step is tested first. Done means the backup files exist, can be opened and read, and a test account can sign in on staging. Keep the backup until the change has passed the login, logout and timeout checks in production.

  2. Create the session directory with restricted permissions

    The server administrator creates a new directory outside the web root and sets its owner to the web server user that runs PHP for your instance. Other local users should have no access, and the web server user should be able to write to it. Confirm with your platform team which user runs PHP in your setup, since a mismatch can cause login failures after the change. Done means a test file written as the web server user appears in the directory, and a write attempt from another local account is refused.

  3. Set the session directory in configuration

    The administrator sets the session directory in the legacy configuration key named session_dir, then adds the matching setting in the Symfony framework configuration extension for SuiteCRM 8. Confirm the exact key names against the SuiteCRM 8 documentation for your release before editing. Both values should point to the same absolute path, and each file must stay valid for its format. Run the available PHP and YAML syntax checks before saving. Done means both files pass the syntax check and a diff against the backup shows only the intended lines.

  4. Clear the Symfony cache

    Run bin/console cache:clear from the SuiteCRM root as the same user that owns the instance files, so the cache folder keeps its ownership. Configuration changes can appear to have no effect until the cache is cleared, so this step is required even if the change looks applied. Done means the command finishes without errors, and the next web request writes a session file to the new directory. If any cache folder ends up with the wrong owner, fix ownership before the next test.

  5. Test login, logout and session timeout

    A tester signs in with a standard user account and an administrator account, opens several modules, and confirms that session files appear in the new directory. The tester then signs out and confirms the old session no longer works, and waits for the timeout set in your configuration to confirm the user must sign in again. If you use SAML, signing out at the identity provider does not end the SuiteCRM session, so test logout inside SuiteCRM itself. Confirm that scheduled jobs and the Messenger worker still run under the new permissions. Done means each check is recorded with the time, account and result.

  6. Roll back if any check fails

    If login, logout, timeout or background job checks fail, restore the backed-up configuration files and run bin/console cache:clear again. Confirm the instance returns to its previous behavior by signing in with a test account. Leave the new directory in place until the rollback is verified, so active sessions are preserved during the check. Record the failure, the configuration versions and the permissions in the change ticket before retrying on staging. Done means users can sign in on the original setup and the failure is documented.

How garbage collection and session lifetime interact with a custom path

Moving the session directory does not remove the session files already sitting in the old location, and it does not start cleaning the new one by itself. PHP garbage collection decides when expired session files are deleted, and it works from the configured lifetime and the probability settings for the collector. Those settings belong to PHP, and they may also be overridden in the SuiteCRM or Symfony configuration. Before you change the path, record the active values for session.gc_maxlifetime, session.gc_probability and session.gc_divisor on the web server and the PHP-FPM pool that serves SuiteCRM, because the command-line PHP that runs cron may read a different php.ini.

A custom directory has to be cleaned by the same policy as the default one. Decide whether the old directory is emptied once the new path is confirmed working, and whether files left in it need to be removed for data retention reasons. Then confirm that the lifetime and collection settings in effect for the web requests match what you intended, and check the directory on the new path after a period of normal use. If the files keep accumulating or never shrink, the collector is not running against that path, so the cause is either the settings or a directory that PHP never sees as its session save path.

Ask your administrator or partner to show the effective settings from a request that goes through SuiteCRM, not only from a shell session, and to confirm that the path PHP reports matches the directory you configured. Also confirm that the directory is writable only by the account that runs PHP, because a directory that other users can list or write to adds risk alongside the cleanup gap. Record the result in the change record so the next person who looks at session growth knows which settings and path were checked.

Security and permission risks of session directory changes

Moving session storage changes who can read session data, where it lives, and how long it survives. The risks below cluster around file access, leftover data, stale configuration, and the gap between identity provider logout and the SuiteCRM session. Check each one before and after the change.

Session files readable by other users

PHP session files hold the state of logged-in users, so a new directory must not be readable by other local accounts on the server. Confirm that the directory is owned by the account that runs PHP-FPM or Apache and that its permissions block access for any other user. Check the same on every web node if SuiteCRM runs behind a load balancer, because a permissive mode on one node exposes that node's sessions.

Wrong ownership outside the web root

A custom session directory is often created outside the web root, under a path that root or a deployment user created. If the web server user cannot write to it, logins fail or sessions are lost, and the usual fix of widening permissions can open the directory to other users. Set ownership and mode deliberately, then confirm that console commands run as root do not change ownership of the directory afterward.

Leftover sessions in the old path

After you point SuiteCRM at a new location, session files in the original directory remain until PHP's garbage collection removes them. Those files still contain valid session data for users who were logged in before the change. Decide whether to let them expire, or remove them after a planned sign-out window, and confirm the old directory is no longer on the web server's path.

Cache holding stale configuration

SuiteCRM caches configuration, so a session path change in the config file may not take effect until the cache is cleared. A node that still reads cached configuration can keep writing sessions to the old directory while other nodes use the new one. Clear the Symfony cache on each node after the change and confirm the active session location from the running instance, not only from the file.

Sessions surviving identity provider logout

When SuiteCRM 8.7.0 or later uses SAML, logging out at the identity provider does not end the SuiteCRM session, and IdP-initiated logout is not supported. Sessions in the custom directory can therefore stay valid after a user leaves the identity provider. Plan session lifetime and user sign-out procedures with this limit in mind, and test that a logout in SuiteCRM removes the session file.

SAML configuration reference

Questions teams ask before changing SuiteCRM session storage

Can an admin change SuiteCRM session storage without outside help?

Yes, if the admin has shell access to every web node, can edit the configuration files, and can restart the web server and PHP processes during a change window. The change itself is small: a session_dir setting in the legacy config or a framework.yaml extension in SuiteCRM 8, followed by a cache clear and a permissions check. The risk sits in the surrounding work. Someone must confirm that the directory is writable by the web server user, is not web-accessible, is cleaned up by garbage collection, and is shared correctly if more than one node serves users. Teams without that Linux and PHP depth usually find a short review worth the time.

What makes the session storage change harder or easier?

Four factors shape the effort most:

  • The hosting layout: a single server with local disk is far simpler than a load-balanced pool with separate application and worker hosts.
  • The number of web nodes: each node must reach the same session directory, or users will be logged out when requests land on a different server.
  • Security review: a directory holding session data must be locked down, and reviewers will want to see the ownership, mode and location written down.
  • Existing customizations and tooling that read or write session files.

Ask for a written list of nodes, their operating system and how the directory will be mounted before you agree on scope.

Do we need a partner to move SuiteCRM sessions to a custom directory?

Not always. A partner adds value when the environment is multi-node, runs under strict change control, or is part of a regulated system where the evidence of the change matters. DeployOpen plans, implements and verifies this kind of hosting change in infrastructure the client controls, and most engagements are fixed-scope with the scope, deliverables and timeline agreed in writing before work starts. If you keep the work in-house, document each step so the next upgrade or node rebuild does not repeat the trial and error.

How long does testing take for a session directory change?

Testing length depends on the environment, not on a fixed number. A single staging instance with one web node can be checked through login, logout, session timeout and a few record saves. A pool of nodes needs tests across each node, a restart of each service, and a check that garbage collection removes expired files without deleting active ones. Ask your team or partner to name the test cases and the environments they will run in before agreeing on a timeline, and confirm the window for the production change with your change board.

What must our team provide before a session storage change?

Plan to provide four things:

  • Shell access with sudo rights on each SuiteCRM host, or a change ticket that names who runs each command.
  • A staging instance that mirrors production's PHP version, web server, and node count, with a current database and file backup.
  • A change window approved by the owners of the application, the web server and any load balancer.
  • A named contact who can confirm login, user impact and rollback decisions during the window.

Ask your partner to put this list into the written scope.

Does the session directory change survive SuiteCRM upgrades?

Not automatically. Configuration you set in the legacy config or in a framework.yaml extension should persist across upgrades, but a server rebuild, a new PHP version, a cache clear that touches the wrong folder or a reset of file ownership can undo the effect or break access. Add the session directory to your post-upgrade checklist, verify ownership and mode after each upgrade, and retest login on every node. Read the release notes for each SuiteCRM minor release before you upgrade, and confirm the current configuration behavior in the SuiteCRM documentation for your version.

What does a session directory change cost?

The cost comes from the people and time involved, not from a license, since SuiteCRM is free to download and self-host. Expect to pay for administrator time to plan and test, a review of the security and hosting impact, and the change window itself. Costs go up with more nodes, stricter review and missing documentation, and go down with an accurate host inventory and a staging copy. Ask any provider for a fixed-scope quote that lists the hosts, the environments, the tests and the handover documents, and ask which items recur after each upgrade.

How a SuiteCRM request reads and writes its session

The diagram starts with a browser request reaching the web server under the web server user, then follows PHP's session handler to the configured session directory. The SuiteCRM application reads and writes session data there, and the cache layer and garbage collection touch the same path. The trust boundary sits between the web server user and other operating system users, so check that the directory's owner and mode let only the web server user and the intended cron or console users reach it.

Session reads, writes and garbage collection all meet at one configured directory.

How DeployOpen works on this

DeployOpen plans and implements SuiteCRM session storage changes inside your own infrastructure, with the scope, permissions and verification steps agreed in writing before work starts. The work is documented and handed over so your team can run the setting, clear caches and check permissions after future changes.

How we scope

  • Confirm the SuiteCRM 8 version, PHP version and web server user on each instance in scope.
  • Record which configuration mechanism your install uses, the legacy config or the Symfony framework.yaml extension.
  • Agree the session directory path, ownership and permissions, and who approves the change on staging and production.

How we build

  • Apply the session directory change on a staging instance first, with a file and database backup taken beforehand.
  • Review customizations and non-core files so that a later migration or upgrade does not remove them unexpectedly.
  • Set and test session garbage collection, cache clearing and directory permissions for the web server and cron users.

How we hand over

  • Deliver a written runbook covering the configuration keys, file paths, cache commands and permission checks used.
  • Walk your administrators through a test login, session expiry check and a rollback procedure before production sign-off.
  • Document what to check after each SuiteCRM minor release, since upgrades can reset configuration or file ownership.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrade checks and retesting of session behavior are available as a retainer.
  • Ask any quote to itemize staging work, production change, handover and retainer options separately.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.