We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Volt problem when i rename my controller

Hey guys,

This problem occurs when i renamed some of my controllers, before i have CurrentController name and i change it to CurrentprojectsController also i rename the view folder of this controller and delete everything on my cacheDir to make a new view file but the it returns

Warning: Phalcon\Mvc\View\Engine\Volt\Compiler::compileFile(C:\Users\spilagan20140973\Desktop\BOOTSTRAP FILES\PORTABLES\USBWebserver v8.6\root\PHALCON-BASE\app\config/../../app/cache/c__users_spilagan20140973_desktop_bootstrap files_portables_usbwebserver v8.6_root_phalcon-base_app_views_currentprojects_index.volt.php): failed to open stream: Invalid argument in C:\Users\spilagan20140973\Desktop\BOOTSTRAP FILES\PORTABLES\USBWebserver v8.6\root\PHALCON-BASE\public\index.php on line 31
Volt directory can't be written

but the other controller that I didn't rename works fine.



58.4k
edited Nov '14

This is cache of Volt, In order to solve it you must remove the volt folder and then create it

rm -rf app/cache/volt
mkdir app/cache/volt
edited Nov '14

I have tried to remove my cache folder and create a new one like you said app/cache/volt and on my config.php file i used

'cacheDir'       => __DIR__ . '/../../app/cache/volt/',

and have this code on my services.php


$di->set('view', function () use ($config) {

    $view = new View();

    $view->setViewsDir($config->application->viewsDir);

    $view->registerEngines(array(
        '.volt' => function ($view, $di) use ($config) {

            $volt = new VoltEngine($view, $di);

            $volt->setOptions(array(
                'compiledPath' => $config->application->cacheDir,
                'compiledSeparator' => '_'
            ));

            return $volt;
        },
        '.phtml' => 'Phalcon\Mvc\View\Engine\Php'
    ));

    return $view;
}, true);

still i get the error

I have tried to run my project on my laptop and everything is working, but on my desktop its not, i already tried to delete my cache folder and make a new folder named it voltsrender and reconfig my config.php but still not working on my desktop. Whats causing this problem?