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 directory can't be written

hi! when I try to access the route organizacional/puestos/partials
should show a template made with volt but throws me this error

Warning: file_put_contents(/var/www/html/phalcon/public/../Volt/varwwwhtmlphalconpublic..appsOrganizacionalViewsindex.phtml.php): failed to open stream: Permission denied in /var/www/html/phalcon/bootstrap.php on line 95 PhalconException: Volt directory can't be written

I have fedora but it actually works on Mac OSX

can someone help me??

It happens because Volts engine tries to create some files based on your template ones, but it can't due to permission restritictions.

Change your views directory permissions to 777 and apply to enclosed files and folders and try again. I don't know if adding 777 permissions to this folder/files is a good practice (probably not), but for development environment it will solve your issue.



36.8k

yeah i put the permissions to 777 before post ; but the error still appears



98.9k

hi, Does this directory /var/www/html/phalcon/public/../Volt/ exists and is it writable?

ls /var/www/html/phalcon/public/../Volt/


36.8k
Accepted
answer

thanks i resolved the error, it was the selinux



58.4k

Hi I am use ubuntu, i solve problem sudo chown -R www-data:www-data mvc/app/cache/



1.5k

chmod -R a+w app/cache

chmod -R a+w app/cache works for me and I don't think giving 777 permission to views folder is a good idea.

Change volt file permission (Inside app/cache) to 777 .Its working fine.



60

Change volt file permission (Inside app/cache) to 777 .Its working fine. OK,I use this way to handle my problem.It works.Thank You.But i really want to know why???my Email address is [email protected] am waiting for you



114

Navigate to the cache folder under the app folder and use this if you are using ubuntu you can do the same on other apache like apache2 user

sudo chown www-data:www-data -R cache

edited Jan '19

hello, can you help me. Now have the same question in phalcon v-7.2.14 .

the cache config is'cacheDir' => BASE_PATH . '/cache/', I have given Permission to any.

777

But error when using volt engine.

error

Please help.

It happens because Volts engine tries to create some files based on your template ones, but it can't due to permission restritictions.

Change your views directory permissions to 777 and apply to enclosed files and folders and try again. I don't know if adding 777 permissions to this folder/files is a good practice (probably not), but for development environment it will solve your issue.



10.1k

Only your cache dir should be writeable in this case. The views dir should be readable. On what user is php running?

hello, can you help me. Now have the same question in phalcon v-7.2.14 .

the cache config is'cacheDir' => BASE_PATH . '/cache/', I have given Permission to any.

777

But error when using volt engine.

error

Please help.

It happens because Volts engine tries to create some files based on your template ones, but it can't due to permission restritictions.

Change your views directory permissions to 777 and apply to enclosed files and folders and try again. I don't know if adding 777 permissions to this folder/files is a good practice (probably not), but for development environment it will solve your issue.

Hello, the cache and views dir both are readble and writeable. PHP Server Administrator is [email protected].

Is there anything wrong with me?

Only your cache dir should be writeable in this case. The views dir should be readable. On what user is php running?

hello, can you help me. Now have the same question in phalcon v-7.2.14 .

the cache config is'cacheDir' => BASE_PATH . '/cache/', I have given Permission to any.

777

But error when using volt engine.

error

Please help.

It happens because Volts engine tries to create some files based on your template ones, but it can't due to permission restritictions.

Change your views directory permissions to 777 and apply to enclosed files and folders and try again. I don't know if adding 777 permissions to this folder/files is a good practice (probably not), but for development environment it will solve your issue.



10.1k
edited Jan '19

@Flcwl can you hook me up on discord? Let's see if we can pinpoint the issue there and post the solution here.

I'm glad to do but how I can do with it?

in the same controller ViewController

class ViewController extends Controller
{
    // using volt is wrong
    public function voltAction() {
        // Rendering the app/views/view/volt.volt
    }

    // using phtml is ok
    public function phpAction() {
        // Rendering the app/views/view/php.phtml
    }
}

@Flcwl can you hook me up on discord? Let's see if we can pinpoint the issue there and post the solution here.