dwoo-project / dwoo

[UNMAINTAINED] php template engine
http://dwoo.org
GNU Lesser General Public License v3.0
167 stars 58 forks source link

folder not writable on windows 10 #54

Closed aolko closed 7 years ago

aolko commented 7 years ago
Fatal error: Uncaught Dwoo\Exception: The compile directory must be writable, chmod "/themes/colorbars/cache\" to make it writable in D:\OpenServer524\domains\[...].ko\lib\dwoo\dwoo\lib\Dwoo\Core.php:773 Stack trace: #0 D:\OpenServer524\domains\[...].ko\core\modules\Template.php(38): Dwoo\Core->setCompileDir('/themes/colorba...') #1 D:\OpenServer524\domains\[...].ko\index.php(34): MyITV\Template\dwoo('test.tpl', Array) #2 {main} thrown in D:\OpenServer524\domains\[...].ko\lib\dwoo\dwoo\lib\Dwoo\Core.php on line 773

Template.php

+obv include_once $_SERVER['DOCUMENT_ROOT'] . "/lib/autoload.php";

using openserver 5.2.6 w/ "Apache-PHP7+nginx-1.10" + php7.1

aolko commented 7 years ago

ETA? It's quite urgent

emulienfou commented 7 years ago

Need to mount a Windows environment to fix your problem, I'll see that ASAP when I finish my job! Fix can be done tomorrow or in 2 days!

emulienfou commented 7 years ago

I think your problem is more in your side, it seems Apache and PHP cannot access to an existing directory. You have 2 solutions:

  1. Create the directory manually if not done yet!
  2. Make sure the compile directory and it's parent have good access writes for PHP to create files inside.

Maybe this link can help you: http://superuser.com/questions/106181/equivalent-of-chmod-to-change-file-permissions-in-windows

Let me now if this information help you, otherwise I will check more testing your code in a Windows environment.

aolko commented 7 years ago

see, the problem is, even if i run my env (which is open-server) as administrator it (dwoo) still can't write to the directory for some reason, as for windows directories are in the intermidiate state of read only, unchecking that does not help, due to the fact that it resets back, granting full access does not help as well

emulienfou commented 7 years ago

Hi! Just try your code on a Windows environment, now I confirm you need to create manually the full path of your cache and tpl directories.

Your code is working perfectly for me, you just need some adjustments such as:

$path = [
   "tpl_path" => './' . $theme_root . '/' . $theme_dir . '/' . $tpl_dir . '/',
    "theme_path" => './' . $theme_root . '/' . $theme_dir,
    "cache_path" => './' . $theme_root . '/' . $theme_dir . '/' . 'cache'
];

However, there is an error in the documentation, the method Core::setTemplateDir() do not exists yet! I will fix this ASAP for the next release!

Let me know if the example above is working for you now!

aolko commented 7 years ago
Fatal error: Uncaught Dwoo\Exception: Call to undefined method Dwoo\Core::setTemplateDir() in D:\OpenServer524\domains\[...].ko\lib\dwoo\dwoo\lib\Dwoo\Core.php:1706 Stack trace: #0 D:\OpenServer524\domains\[...].ko\core\modules\Template.php(40): Dwoo\Core->__call('setTemplateDir', Array) #1 D:\OpenServer524\domains\[...].ko\index.php(34): MyITV\Template\dwoo('test.tpl', Array) #2 {main} thrown in D:\OpenServer524\domains\[...].ko\lib\dwoo\dwoo\lib\Dwoo\Core.php on line 1706

seems to be working, and you've already mentioned Core::setTemplateDir()