Yii中使用gii遇到“unable to write the file”
显然这是因为gii没有权限来写文件,所以如果你按照http://www.yiichina.com/doc/guide/2.0/start-gii 这里和之前的步骤来做的话,你必须先把下面文件先删除:
rm /var/www/html/basic/models/Country.php
rm /var/www/html/basic/controllers/CountryController.php
rm /var/www/html/basic/views/country/index.php
然后给web权限:
chown www-data:www-data /var/www/html/basic/models
chown www-data:www-data /var/www/html/basic/controllers
chown www-data:www-data /var/www/html/basic/views/country
接着就可以访问http://机器名/basic/web/index.php?r=gii 来生成model和CRUD,弄完之后访问页面http://机器名/basic/web/index.php?r=country/index,一切正常运行之后,最好把权限改回来:
chown root:root /var/www/html/basic/models
chown root:root /var/www/html/basic/controllers
chown root:root /var/www/html/basic/views/country