Grav, code highlight and mod_security...


Grav, code highlight and mod_security...

I changed my hosting package recently and because of my mistake, i purchased one, that wouldn't allow to dis-able the PHP mod_security module. That lead to some problems, with the biggest one, that now, Grav CMS couldn't store pages, that was using the Prism Highlighter and contained keywords like echo, printf and others. This means, that i wouldn't be able to publish almost any of my scripts... disaster! To explain it a bit more, for security reasons in those shared hosting packages, more security measures are applied, that cannot be disabled, and one of those measures, is to not be able to parse code, with tools like code highlighters, cause this, under specific circumstances, could lead to execute illegal code.

One solution, is to just store the code as a file in the server and put a link on the blog page, for the visitors to download. I don't like that! I want the visitors, to be able to see the code online and if they like it, to copy/paste it. So i had to figure something else...

Hopefully... Grav CMS, saved the day... because Grav, stores anything on files, even the posts/pages are just files. Not like, for example Wordpress, that stores them in a database. This made it very easy to SSH to the server, find the file, that a page/post is stored and edit it directly. This way, i can add the code after the page/post is published, by passing any restrictions ;) So, again i was able to post my code...

Also the more obvious way, is to upgrade the hosting package... but... naaah... i too cheap.. to do so... hahahaha :)

Add a comment

Previous Next