March 19th in PHP Scripts by .

Alternative to smarty templates_c folder 777 permission!

i have often used smarty with php as it separates the application from the presentation. If you use smarty then it is a must to set 777 writable permission to templates_c folder, only then your site will work properly.

Many people are afraid to set 777 writable permission which means anybody could write on the server which leaves more vulnerable. If you dont set 777 permission smarty will throw up this error

Smarty error: unable to read resource: XXX in line XX

There is an alternative way way to make smarty work without 777. You can safely set 775 to your smarty templates_c folder.

1. First set 777 permission to templates_c folder.
2. Surf all your site php pages once (or) if you have visitors automatically coming to your site, leave 777 for 2 days, so that smarty could generate temporary files in templates_c folder.
3. After change templates_c folder to 775.
4. Thats! you have to do it once and your site will work property without 777 writable permission.

Note: If you make changes to your .tpl files you will have to go through manually above steps only then new cache files will be generated.

This is just one time manual process, but you will have peace of mind not having assigned 777 permission.

This is a trick i use every now and then.

Similar Posts:

Leave A Comment.