I struggled a little with getting my PHP stack (Wordpress) working like the Rails setup. Running Rails inside Toolbox is trivial because Puma is already installed there as a gem and you don’t need a systemd service for it. However, running httpd as a container and PHP inside a toolbox just turned into more trouble than it was worth. I don’t need to build extensions inside the PHP container either, so running a LAMP stack could be done with podman only. I’m posting it here because it may be helpful to the original poster since he was setting up PHP specifically.
First I setup up a container for PHP with Apache and connect it to a new pod to simplify db setup. I found webdevops/php-apache to be a sensible Docker image (it uses
/app as httpd root), but I’m sure there are others. I run this from my Wordpress root directory:
podman run --security-opt label=disable -it --name wp_apache --pod=new:wp -p 8080:80 -v $PWD":/app/ -d webdevops/php-apache:latest
Then I download and run a podman container for MariaDB and connect it to the newly created
podman run --security-opt label=disable -it --name wp_maria --pod=wp -e MARIADB_ROOT_PASSWORD=strongpassword -e MARIADB_DATABASE=wp -e MARIADB_USER=username -e MARIADB_PASSWORD=password -d mariadb/server:latest
I then had to use choose the db inside the mariadb container (maybe this step could be skipped somehow):
podman exec -it wp_maria bash -lc mysql
# Then inside the container:
Then I could connect and use my development environment provided I put wp (i.e. the name of the pod) instead of localhost in my wp-config. I have never used Laravel or other PHP frameworks and I rarely use composer, but I imagine you could modify this to make it work.
I’m sure there are better ways you could do this, so feel free to suggest improvements.