Error in phpMyAdmin after updating to v4.8.0: The $cfg['TempDir'] (./tmp/) is not accessible

Error in phpMyAdmin after updating to v4.8.0: The $cfg['TempDir'] (./tmp/) is not accessible

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Error in phpMyAdmin after updating to v4.8.0: The $cfg['TempDir'] (./tmp/) is not accessible

If you recently upgraded from phpMyAdmin version 4.7.9 to 4.8.0 and encountered an immediate performance warning regarding the TempDir, the issue stems from how the application now handles template caching. This specific error message—*"The $cfg['TempDir'] (./tmp/) is not accessible"*—indicates that the server process cannot write to the directory configured for temporary files. In version 4.8.0, phpMyAdmin became stricter about this requirement because it relies on these cached templates to prevent regenerating them on every page load, which would otherwise introduce significant latency.

The core of the problem usually lies in file permissions rather than the existence of the folder itself. You mentioned attempting to resolve this by creating a directory at /usr/share/tmp and pointing phpMyAdmin (located at /usr/share/phpmyadmin) to it. However, simply creating the path is insufficient; the operating system must grant write privileges to the user running the web server.

Verifying File Ownership and Permissions

When you manually create a temporary directory outside of the standard installation paths, the default ownership typically belongs to your current user or root, not the web server process (often www-data, apache, nginx, or pma). If the web server cannot write to this location, phpMyAdmin throws the error and falls back to rendering templates in PHP memory, causing the slowdown described in the warning.

To fix this, you must ensure the directory is owned by the user that serves your website. Assuming a standard Debian/Ubuntu setup where the web server runs as www-data:

sudo mkdir -p /usr/share/tmp
sudo chown www-data:www-data /usr/share/tmp
sudo chmod 770 /usr/share/tmp

The 770 permission mode allows the group to read and write, which is generally safer than 777, provided the group includes the web server user. If you are using a different distribution (like CentOS) or a specific user for your database tools, adjust the ownership (chown) accordingly to match the process running phpmyadmin.

Configuration Adjustments

If you prefer not to manage a separate system directory, you can configure phpMyAdmin to use a relative path within its own installation structure. The default configuration expects a tmp folder alongside the application root (e.g., /usr/share/phpmyadmin/tmp).

  1. Navigate to your configuration file, usually located at /usr/share/phpmyadmin/config.inc.php.
  2. Locate the $cfg['TempDir'] setting.
  3. Ensure it points to a valid directory that exists and is writable by the web server.
// Example: Using a relative path within the installation folder
$cfg['TempDir'] = './tmp';

// Or using an absolute path if /usr/share/tmp is correctly set up
$cfg['TempDir'] = '/usr/share/tmp';

If you use the ./tmp setting, ensure that a tmp folder actually exists inside /usr/share/phpmyadmin. If it does not exist, create it and apply the same ownership rules:

sudo mkdir -p /usr/share/phpmyadmin/tmp
sudo chown www-data:www-data /usr/share/phpmyadmin/tmp
sudo chmod 770 /usr/share/phpmyadmin/tmp

Why This Changed in v4.8.0

The shift from 4.7.9 to 4.8.0 likely involved a stricter check on the TempDir accessibility during initialization. In older versions, phpMyAdmin might have ignored missing or unreadable temp directories more gracefully, deferring the caching logic until runtime. The new version fails fast if the path is inaccessible, forcing you to address permissions immediately.

Ignoring this error means every time you load a dashboard or execute a query, the application regenerates SQL templates on the fly. While this functionality isn't broken, the lack of cached templates significantly degrades user experience, especially with complex dashboards or heavy data visualization components.

Troubleshooting Common Pitfalls

A frequent mistake involves trying to set permissions recursively (chmod -R 777) without changing ownership. This creates a security risk and often fails because the web server user still doesn't own the files initially. Always prioritize chown before adjusting chmod. Additionally, if you are using Docker, ensure your volume mounts for the temp directory reflect these permission changes inside the container, or configure the environment variable PMA_TMP_DIR to point to a writable volume owned by the container's user.

By aligning the file system permissions with the web server's execution context and ensuring the configuration path matches reality, you restore the caching mechanism and eliminate the performance penalty introduced in the update.

Our network