Welcome Guest, Not a member yet? Register   Sign In
What is my current working dir?

(This post was last modified: 05-03-2020, 12:44 PM by jreklund.)

My code is running in a container. I check to see if a certain file exists and it fails. But when I run 

$ docker exec 6adf ls -ls /app/assets/image_crud/views/list.php

I get:

8 -rwxrwxrwx 1 1001 134 5744 Feb 23 06:48 /app/assets/image_crud/views/list.php

Which means that the file was found. 

My code is trying to run if (file_exists($view_file.$file))
and $view_file= "/assets/image_crud/views/"
and $file="list.php"
But this fails so I tried
$view_file.$file= "/app/assets/image_crud/views/list.php"
and that fails too. 

So I am thinking the path is screwed. How can I tell what the CI code thinks the path is? Or is this a docker issue? How can I debug this?
proof that an old dog can learn new tricks

(This post was last modified: 05-03-2020, 12:49 PM by jreklund.)

You should base your paths against these.

// The name of THIS file (index.php)

// Path to the system directory

// Path to the front controller (index.php) directory

// Name of the "system" directory

// Path to the "application" directory

// Path to the "views" directory

Thanks. I think the issue might be the way in which the volume was created. I am using a BIND volume which means that the host and the container share the directory on the host. The issue I think is the propagation parameter. Mine is set to the default of rprivate when I think it needs to be "rshared". I tried setting that correctly in the docker-compose by using bind-propagation: rshared. and then rebooting. But when I run docker inspect I see that the Propagation is still "rprivate". I don't know why. I didn't set up the system so I am hoping that I am using the correct docker-compose.
proof that an old dog can learn new tricks

You are the only person I have seen here that are using Docker, you may need to try a different forum for that question then.

(This post was last modified: 05-04-2020, 02:55 PM by maxxd.)

I'm using a homespun Docker image and not having issues with directory binding. What's the server root in your configuration (I'm assuming Apache because that's what I know - don't know what it's called in nginx).

Actually, what does the CI service section of your docker-compose file look like?

Hi Max. Nice dog! We adopted a new dog yesterday and i spent the last day trying to teach it to use the dog door instead of peeing on the floor! I have a bunch of containers being spawned by docker compose. The two of interest are:
    image: bitnami/apache:latest
    restart: unless-stopped
      - 80:8080
      - ./apache/app.conf:/vhosts/app.conf:ro
      - ./app:/app
      - net

    build: ./php
    restart: unless-stopped
    image: bitnami/php-fpm
      - ./app:/app
      - XDEBUG_CONFIG="remote_host="
      - net
I didn't create this docker-compose and am really a docker neophyte. I really don't understand why this is a shared volume but docker inspect shows it as a bind. I need to change the propagation to rshared (I think).

    "Type": "bind",
    "Source": "/opt/docker-substantiator/app",
    "Destination": "/app",
    "Mode": "rw",
    "RW": true,
    "Propagation": "rprivate"

I think that this is the docker-compose that is being used (and restarted). Right now I am looking the the vol-options and hoping I can use this to modify the "propagation" type. Glad to hear someone else up here is using Docker. It is pretty much required if you are serious about your webApp, IMO. Previously I debugged my app directly on the Server and hope to never do that again!
proof that an old dog can learn new tricks

Try to see if this example can help you:

Docker Image for CodeIgniter4 development
Codeigniter 4 - Docker Image [github] [docker hub]

Thanks. My environment (wo a CI container) seems to work pretty good.
proof that an old dog can learn new tricks

@richb201 - congrats on the new addition to the family! As far as your question goes, I'm not sure about the Bitnami stuff - I based mine off the official PHP docker image, but I'm not sure you need to set up the shared volumes in both services. The apache.conf volume share also seems a bit strange to me as does the port asssignment, but again that could be the Bitnami setup. If you're running into issues you might want to give @atsanna's a go - it looks good.

The development environment has worked surprisingly perfectly. I am just having two small "game changer" issues. I work with Goggle oauth and am having trouble authenticating a user to the server in the container. That has been around for a while and works fine wo the container. And now I have this rprivate vs rshared issue. I am trying to get an image library working for users to add screen shots of their documents to the jaspereports report. The library "image_crud" is not working correctly and I have traced the problem in the image_crud library down to a "file_exists()" problem. I thought it was a php/CI issue but it seems to be a docker "shared volumes" issue.

The dog is working out well except she doesn't seem to want to use her face to push open anything (like doors or dog doors). I am not sure what to do about that. I am waiting on some "electric fence flags" so I can start to train her on the electric fence around the property. She is a "dog show" bitch which means (I think) that she didn't get a whole bunch of human contact in the past. But she is stunning looking. And super nice. And fairly overweight IMO. Not in an obese way. As I said, she looks like something you would see at the Westminster Dog Show, but I am just not sure that carrying that much weight is good for her joints.
proof that an old dog can learn new tricks

Theme © iAndrew 2016 - Forum software by © MyBB