Basic App

An open source simple CMS based on CodeIgniter 4

Automatic assignment of 0777 access permissions in CodeIgniter 4

When you deploy any web application on the server, in most cases, you need to set 0077 write permissions to some directories, and also create local configuration files. At the moment, CodeIgniter 4 does not contain this feature, although it is likely to obtain it in the future.

You can use the module installer from the Yii framework to copy files and set access permissions to files and directories. It is well suited for this task, for it is an independent package that does not require the Yii framework, nor any other libraries.

Example of composer.json configuration:

"require": {
    "yiisoft/yii2-composer": "^2.0" 
"scripts": {
    "post-create-project-cmd": [
"extra": {
    "yii\\composer\\Installer::postCreateProject": {
        "copyFiles": [
               "environment/.env": ".env" 
        "setPermission": [
                "writable/cache": "0777",
                "writable/debugbar": "0777",
                "writable/logs": "0777",
                "writable/session": "0777",
                "writable/uploads": "0777"

This configuration example sets Composer the following way: when deploying an application on a new server, Composer copies the .env file from the /environment directory to the application root, and also sets necessary access permissions to the directories in which CodeIgniter 4 creates files.

Posted on 2019-01-25