Welcome! » Log In » Create A New Profile

Directory .../Serializer not writable, please chmod to 777 in ../Serializer.php

Posted by A. 

Hello, I am getting these errors in my error_log every time I try to access pages where it uses htmlpurifier.

Directory /var/www/html/classes/library/HTMLPurifier/DefinitionCache/Serializer not writable, please chmod to 777 in /var/www/html/classes/library/HTMLPurifier/DefinitionCache/Serializer.php on line 292

What exactly is the purpose of this file, and I've read other places that it's bad practice to chmod to 777.

Any help on what I should do, or if anyone have same problem?

I'm on Ubuntu 16.04 with Apache2 + PHP7.0

Re: Directory .../Serializer not writable, please chmod to 777 in ../Serializer.php
October 08, 2017 11:14PM

It's a cache for a large pile of helper data structures which HTML Purifier needs to do its work. In principle, you could avoid having HTML Purifier ever writing to this directory by making sure the cache files you need are always present, but in practice this is pretty annoying and no one does it.

It's not necessary to 777 the folder; any permissions for which the server running PHP has write access to the directory will do.

Your Email:


HTML input is enabled. Make sure you escape all HTML and angled brackets with < and >.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

Place code here

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}