Questions? Feedback? powered by Olark live chat software
Author Avatar

mod_pagespeed Failed to make directory Errors

Written by: on 04 June 2020 12:12 PM 04 June 2020 12:12 PM

If you have enabled mod_pagespeed in cPanel, and you are seeing lots of errors in the Apache log at /var/log/apache2/error_log that look like this:

Failed to make directory /var/mod_pagespeed/cache/shm_metadata_cache

The best option is to make Apache run in MPM_EVENT mode, this is done in EasyApache 4. This makes Apache run as nobody and then mod_pagespeed works as normal.

However, if this is not an option and you really want to run mod_pagespeed a dirty hack is the only way to do it. This is because mod_pagespeed by default only provides permission to the cache folder to the nobody user. This only works if your Apache process runs as nobody. If you are using mod_ITK or MPM Worker modes or any other SuExec style mod that makes Apache run as a specific user, then the permissions on the cache folder must be changed.

Open WHM -> Terminal


chmod 777 /var/mod_pagespeed/cache/shm_metadata_cache -R

chmod 777 /var/mod_pagespeed/cache/v3 -R

This will allow any user to write to the mod_pagespeed cache, so regardless which mode Apache is running in.

You will still see "RateController: drop deferred fetch of " warnings in the log, this is normal behaviour for mod_pagespeed. This can also be disable by:

ls /etc/apache2/conf.modules.d/ | grep pagespeed | xargs sed -i 's/ModPagespeed on/ModPagespeed on\n  ModPagespeedRateLimitBackgroundFetches off/g'

service httpd restart



(0 vote(s))
Not helpful