Smarty permissions problems

21,459

Solution 1

Could it be a problem with relative paths? Could you add the complete paths for you set****Dir functions, so you'll be sure you're using the correct locations.

If you call this from a /specialdir/thisdirhasonlyaPHPfile/file.php location, you might get in trouble.

Solution 2

Proper permissions solved it for me:

chown -R www-data /var/www/HRTRL
Share:
21,459

Related videos on Youtube

afkbowflexin
Author by

afkbowflexin

Updated on August 08, 2020

Comments

  • afkbowflexin
    afkbowflexin over 3 years

    Smarty is complaining about permissions. I've written a small mvc framework for a project I'm working on and I need to be able to render templates in each controller. I went ahead and followed the Smarty installation instructions, and set all of the configuration options in my "front controller", or the page that routes requests to the rest of the application. The testinstall function says everything is kosher, yet when I attempt to render templates in my controllers, I end up with this.

    Warning: mkdir(): Permission denied in /var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php on line 28 Warning: rename(/tmp/wrt6piczo,./templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php): 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(): No such file 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.tpl.php): failed to open stream: No such file or directory in /var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_template.php on line 423 Warning: include(): Failed opening './templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php' for inclusion (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 have tested the rest of my framework independently and everything seems to work. My "front controller" routes requests properly to the correct controllers, and I seem to be able to render regular HTML just fine.

    Additionally, I have chmodded all of the Smarty library folders as well as the other required directories to 777 just for the sake of testing. I'm still receiving the same permissions errors.

    EDIT

    These are the settings I've used for all 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');
    
    • ircmaxell
      ircmaxell over 13 years
      Why do you want to use Smarty? Why not just use PHP itself (and save yourself from these hassles)?
    • afkbowflexin
      afkbowflexin over 13 years
      The end result must be designer friendly. I will not likely be designing all of the views myself.
    • Luke Stevenson
      Luke Stevenson over 13 years
      Personally, I kind of like Smarty. Anyway, can you show us the Smarty Config settings you are using? If the directories have the right permissions, then maybe it is just looking in the wrong places...
    • afkbowflexin
      afkbowflexin over 13 years
      I switched to Dwoo. Problem fixed.
  • Ken Ratanachai S.
    Ken Ratanachai S. over 9 years
    This helped me. Thanks!
  • None
    None about 7 years
    I would look into why 775 doesn't work as that should be the loosest permissions for any file/folder in your project and is why the documentation says 775 and not 777.