I have Ubuntu 11.04 system and login as root. Web server folder is /var/www/, where located framework folder. In that folder I have folder “projects” for my projects. And there folder “sample”. I have made table tbl_article for storing articles. When I use web page for generation model file, it’s get my that error:
Generating code using template "/var/www/framework/gii/generators/model/templates/default"...
Unable to write the file '/var/www/projects/sample/protected/models/Article.php'.
In file /etc/php5/apache/php.ini I set everywhere safe_mode is off. Where I’am wrong?
Your user/group which is running the apache webserver has insufficient rights to create the model.
// change group of models directory to www-data which is by default the apache group
sudo chown -vR your_user:www-data /var/www/projects/sample/protected/models
// change permission so that you and the group (->apache) is able to read and write to models directory
sudo chmod -vR 0664 /var/www/projects/sample/protected/models
The protected/assets and protected/runtime folder should also be writable by the apache user/group so do the commands also for those folders.
As I mention early, I’am root in my system, but apache, when starts, create new user and group with name web-data. So I go throw nautilus to folder /var/www and in it properties set owner and group to web-data. It’s start working. Thanks for advise, topic is closed.