yii php framework “Application runtime path is not valid.” exception

前端 未结 9 1000
旧巷少年郎
旧巷少年郎 2021-02-05 17:03

I tried to make a yii project for testing by executing

/var/www/html/yii/framework/yiic webapp demo

and when I go to localhost/demo I get en er

相关标签:
9条回答
  • 2021-02-05 17:36

    That should work... so maybe also try setting your Apache user (usually 'www-data') as the owner of /runtime? Something like:

     chown -R www-data:www-data /var/www/html/demo/protected/runtime
    

    Could be an Apache umask issue also. Check out the Yii forum, which has helpful posts like this one: http://www.yiiframework.com/forum/index.php?/topic/19400-question-about-directoryfile-permissions/

    You should NOT have to set your whole project to 777, that is very insecure. I think /assets and /protected/runtime are the only directories that need write permissions (775).

    0 讨论(0)
  • 2021-02-05 17:41

    You have entered a wrong syntax for the chmod command. Try this:

    sudo chmod -R 777 ./var/www/*
    

    Enter a password when you will be prompt.

    Important notice:

    The asterisk at the end of command line is very important. It means all files in the current directory.

    0 讨论(0)
  • 2021-02-05 17:51

    Looks like you might have SELinux turned on, which enforces it's own security policies and can be a real pain for web apps and very annoying when it ends up resulting in errors like this. Whenever you have funky permissions problems, it's a good idea to check if you have it set: /usr/sbin/getenforce (or similar, depending on what system you are on).

    See: http://www.crypt.gen.nz/selinux/disable_selinux.html for a good overview and how to turn it off (again, the details may vary depending on your OS/kernel version). If it's a test machine not publicly accessible, you can pretty safely turn it off, otherwise, you should read the site above to understand what it does. Most Linux package managers can install files to help you manage the policies for specific apps. On RH/CentOS, you can also use /usr/bin/system-config-securitylevel-tui to turn it on/off.

    0 讨论(0)
  • 2021-02-05 17:56

    When i check it on my server, the 'runtime' folder was missing, so i just upload it on the server and it works. Here is the path to 'runtime' folder yoursite\protected\runtime –

    0 讨论(0)
  • 2021-02-05 17:57

    you must config with semanage like this which allow php-fpm write access to directory

    # semanage fcontext -a -t httpd_sys_rw_content_t 'YOUR_PATH_HERE'
    # restorecon -v 'YOUR_PATH_HERE'
    
    0 讨论(0)
  • 2021-02-05 18:00

    Change access of the runtime folder. On my case changing rwx rwx rwx in plesk parallel panel for runtime folder works.

    0 讨论(0)
提交回复
热议问题