Home  >  Article  >  Backend Development  >  When using gii in Yii, I encounter "unable to write the file"

When using gii in Yii, I encounter "unable to write the file"

WBOY
WBOYOriginal
2016-07-29 08:56:121678browse

??

When using gii in Yii, you encounter "unable to write the file"

Obviously this is because gii does not have permission to write the file, so if you follow http://www.yiichina.com/doc/ guide/2.0/start-gii If you are doing the same as the previous steps, you must first delete the following files:

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

Then give web permission:

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

Then you can visit http://machine name/basic/web/index.php?r=gii to generate model and CRUD. After that, visit the page http://machine name/basic/web/index.php?r=country/index. After everything is running normally, it is best to change the permissions back:

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

The above introduces the problem of "unable to write the file" when using gii in Yii, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn