Smarty error "unable to write to cache directory" after server migration.
This is often a file-permissions problem. After a server migration the new server often runs PHP under a different user, while the copied files still belong to the old account or to root. PrestaShop then cannot write compiled Smarty templates or Symfony cache files.

Clear stale cache files first, then fix ownership and permissions for the writable cache/log paths. Replace www-data:www-data with the user and group your PHP-FPM or web server actually uses, such as nginx:nginx or your hosting account user.
Before running chown, identify the user PHP is actually running as. On a shell with the shop files, useful checks are ps -eo user,group,comm | grep -E 'php-fpm|apache|nginx', grep -R '^user\|^group' /etc/php*/fpm/pool.d 2>/dev/null, or a temporary phpinfo() page checked through the browser. Use that user/group instead of guessing www-data.
cd /path/to/prestashop
# Remove generated cache contents, not the parent directories
find var/cache/prod -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +
find var/cache/dev -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +
# Fix common PS 1.7/8/9 writable paths
sudo chown -R www-data:www-data var 2>/dev/null || true
find var -type d -exec chmod 775 {} +
find var -type f -exec chmod 664 {} +
# Older PS 1.6-style Smarty paths, if they exist
sudo chown -R www-data:www-data cache/smarty 2>/dev/null || true
find cache/smarty -type d -exec chmod 775 {} + 2>/dev/null
find cache/smarty -type f -exec chmod 664 {} + 2>/dev/nullAvoid chmod -R 777. It may hide the error temporarily, but it leaves the shop writable by everyone on the server. If permissions look correct and the error remains, check disk space, inode exhaustion, SELinux/AppArmor policies and whether PHP-FPM is chrooted into a different path.
Our PrestaShop migration guide covers the full move, and the troubleshooting guide covers related white-screen and 500 errors.
Was this answer helpful?
Still have questions?
Can't find what you're looking for? Send us your question and we'll get back to you.