Yii中使用gii遇到“unable to write the file”

简介: Yii中使用gii遇到“unable to write the file”显然这是因为gii没有权限来写文件,所以如果你按照http://www.


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

目录
相关文章
|
3月前
webpack——You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
webpack——You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
442 0
|
6月前
|
Java
cannot open shared object file: No such file or directory
cannot open shared object file: No such file or directory
84 0
|
缓存 前端开发 PHP
PHP - Laravel The stream or file “/storage/logs/.“ could not be opened in append
PHP - Laravel The stream or file “/storage/logs/.“ could not be opened in append
503 0
|
Windows
UE INI File Operation [ Read / Write ] Plug-in description
UE INI File Operation [ Read / Write ] Plug-in description
67 0
error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file
error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file
214 0
|
JavaScript
The file is in the program because: Imported via xxx Root file specified for compilation Vetur(1261)
The file is in the program because: Imported via xxx Root file specified for compilation Vetur(1261)
187 0
The file is in the program because: Imported via xxx Root file specified for compilation Vetur(1261)
error while loading shared libraries: libxx.so: cannot open shared object file: No such file
error while loading shared libraries: libxx.so: cannot open shared object file: No such file
109 0
|
开发工具 Android开发
unable to write jarlist cache file
unable to write jarlist cache file
99 0
|
前端开发 Android开发
springMvc15-Referenced file contains errors
springMvc15-Referenced file contains errors
80 0
|
Unix Shell Linux