unit icon indicating copy to clipboard operation
unit copied to clipboard

Issue with creating files and folders from PHP

Open elpado opened this issue 11 months ago • 2 comments

Hello dear developers,

I would like to test Unit for a small PHP project. I use the Docker Image with PHP 8.3 installed.

The code of the application is stored within the container under "/mnt/code/". But I have a, let's call it, data exchange directory. This directory lives outside of my application root.

-/
 -- /mnt
     -- /code
-/data-store  <-- exchange directory

My application need to create new folders and files in that exchange directory.

My config.json looks like this:

{
  "listeners": {
    "*:80": {
      "pass": "routes"
    }
  },

  "routes": [
    {
      "match": {
        "uri": "!/index.php"
      },
      "action": {
        "share": "/mnt/code/",
        "fallback": {
          "pass": "applications/exchange-data"
        }
      }
    }
  ],

  "applications": {
    "exchange-data": {
      "type": "php",
      "root": "/mnt/code/public/",
      "script": "index.php",
    }
  }
}

But when I try to create a new directory or file in the exchange folder, I receive a permission denied :(

    mkdir ('/data-store/data-set/2024-03-01', 0777, true);

    mkdir(): Permission denied in /mnt/code/src......

It's the very first time I'm trying to use Unit for one of my applications. I've also tried changing my configuration and adding a user/group - but to no success.

Is there something I have overlooked?

elpado avatar Mar 01 '24 14:03 elpado