Smarty Permission Issues

Smarty complains about permissions. I wrote a small mvc framework for a project that I am working on, and I need to be able to display patterns in each controller. I went ahead and followed Smarty installation instructions and set all the configuration parameters in my β€œfront controller” or page that directs requests to the rest of the application. The testinstall function says that everything is kosher, but when I try to display patterns in my controllers, I get this.

Warning: mkdir (): permission denied in / var / www / HRTRL / includes / CallLog / lib / Smarty / libs / sysplugins / smarty _internal_write_file.php on line 28 Warning: renaming (/TMP/wrt6piczo,/templates_c/73b1662b4c376f493243f34934ffb34f9f9f9f9 .poopy.tpl.php.): there is no such file or directory in / var / www / HRTRL / includes / CallLog / lib / Smarty / libs / sysplugins / smarty _internal_write_file.php on line 48 Warning: chmod (): There are no such files or directory in / var / www / HRTRL / includes / CallLog / lib / Smarty / libs / sysplugins / smarty _internal_write_file.php on line 50 Warning: include (./templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.plopy.plopy Could not open stream: there is no such file or in the directory / var / www / HRTRL / includes / CallLog / lib / Smarty / libs / sysplugins / smar ty _internal_template.php on line 423 Warning: include (): Failed opening './templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php' to enable (Include_path = ': / USR / share / PHP: / USR / share / pear ') in / var / www / HRTRL / includes / CallLog / lib / Smarty / libs / sysplugins / smarty _internal_template.php on line 423

I tested the rest of my framework independently and everything seems to work. My front controller correctly directs the right controllers, and I seem to be able to render plain HTML just fine.

In addition, I used chmodded all the Smarty library folders, as well as other necessary directories for 777 for testing only. I am still getting the same permission errors.

EDIT

These are the settings that I used for all of the required smarty folders.

$smarty->setTemplateDir('lib/smarty/templates'); $smarty->setCompileDir('lib/smarty/templates_c'); $smarty->setCacheDir('lib/smarty/cache'); $smarty->setConfigDir('lib/smarty/configs'); 
+6
php templates smarty
source share
6 answers

Could there be a problem with relative paths? Could you add the full paths for installing **** Dir, so you will be sure that you are using the correct locations.

If you call this from /specialdir/thisdirhasonlyaPHPfile/file.php, you may have problems.

+4
source share

The correct permissions solved this for me:

 chown -R www-data /var/www/HRTRL 
+5
source share

For everyone who deals with permissions with Smarty after doing all of the above (checking config / chown / chmod, etc.). We encountered a problem running Smarty on SE (Security Enhanced) Linux.

Compilation directories / caches were subdirectories inside the ~ / tmp directory.

The default targeting policy prevents writing to tmp directories.

The Senate can be used to update contexts / policies. Most likely, you will need to create a new policy to assign the httpd_sys_rw_content_t context to the directory that your web application needs to write.

Additional information: http://www.serverlab.ca/tutorials/linux/web-servers-linux/configuring-selinux-policies-for-apache-web-servers/ t

0
source share

You must again check the write permissions. I had the same errors, so I set the permissions for 777 for the templates_c folder and something inside, and now it works. However, I had to repeat this operation 3 times in Filezilla, I do not know why it did not immediately change the permissions.

-one
source share

According to the documentation, the permission of the "template_c" folder should be 775. But this will not work. You must set its permission to 777.

-one
source share

Just comment on the next line from the index.php file.

 $smarty->caching = true; 

This will solve your problem.

-2
source share

All Articles