Symfony错误 - 无法写入缓存文件

I have inherited a Symphony site and I get the following error,

Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to write cache file "/var/www/html/app/cache/prod/classes.php".' in /var/www/html/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php:239

I did a chmod -R 777 cache but with no luck. The classes.php file does not exist.

If you are linux user then you need to fire below listed command:

HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1`

sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var

sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var