1
votes

When I run php file,browser shows blank and the error.log file shows following error

[Tue Mar 11 18:51:37 2014] [error] [client 127.0.0.1] PHP Fatal error: Uncaught --> Smarty: unable to write file templates_c/wrt531f0de1310f36.31049288 <-- \n thrown in /var/www/forum/modules/smarty/sysplugins/smarty_internal_write_file.php on line 44

4
That looks like Smarty's templates_c/ directory (where it stores compiled templates) is not writable by the web server. You need to make it writable by the user your web server runs as. - Michael Berkowski
is that file/directory writeable by your scripts? - Marc B

4 Answers

1
votes

That probably means that either the templates_c directory doesn't exist, or the script has unsufficient rights to store files in that folder.

You can make that folder writeable by making adjustments to the permissions using chmod. You can do this in most of today's FTP clients. The directory needs to be writable by the user that runs the PHP code (usually www, apache, nobody).

If unsure, set the directory's permissions to 0777 and that should do the trick. But keep in mind that when you set it to 0777, it is world-writeable, so depending on your setup, you might want to check for the right value.

1
votes

From the Smarty documentation, they recommend using 770 for the templates_c and cache directories. They go on to say that if you have issues, trying 775 may work still.

http://www.smarty.net/docsv2/en/installing.smarty.basic

chown nobody:nobody /path/to/templates_c/
chmod 770 /path/to/templates_c/

chown nobody:nobody /path/to/cache/
chmod 770 /path/to/cache/

When I got this running I assigned the directories go my user and the group www-data.

chown darren:www-data /path/to/templates_c/

Good luck!

-1
votes

chown www-data:www-data -R (FOLDER-ARCHIVE)

-3
votes

give 777 permission to templates_c folder