LAMP Stack on Silverblue

Since this thread appears as one of the top results for a “silverblue lamp stack” Google search, I’m bumping it in order to share my own efforts for setting up a LAMP + phpMyAdmin stack the easiest way possible, but so far I’ve been unsuccessful. Having only recently migrated to Silverblue (which works great otherwise) and started to learn the basics of container workflow, I thought that perhaps you will be able to figure out the proper way to achieve this result.

The commands I’ve been using are saved here, I’m pasting them below:

#launch this from the folder where your PHP files are located

#create pod with port redirections
podman pod create \
  --name lamp \
  -p 8080:80 \ #for Apache
  -p 8081:8081 #for phpMyAdmin

# launch apache
podman run \
  --name php-apache \
  --security-opt=label=disable \
  --pod=lamp \
  -v "$PWD":/var/www/html \
  -d \

# launch mariadb
podman run \
  --name mariadb \
  --security-opt=label=disable \
  --pod=lamp \
  -v "$PWD"/podman/db/data:/var/lib/mysql:z \
  -d \

# launch phpmyadmin
  podman run \
  --name phpmyadmin \
  --security-opt=label=disable \
  --pod=lamp \
  -v "$PWD"/podman/phpmyadmin:/etc/phpmyadmin/ \
  -e PMA_HOST= \
  -e APACHE_PORT=8081 \
  -d \

So far I’ve been able to display my rendered web pages by entering https://localhost:8080 in my web browser, and I can log in to phpMyAdmin from https://localhost:8081. However, I cannot connect to my MariaDB database in my PHP code (using PDO queries). It seems that the mysqli and pdo_mysql extensions are missing from the official phhp Docker image. Should I then consider building my own image myself, or is there a simpler solution that I’m missing?


I’m seeing people struggle with this (myself included!) and was thinking, it’d be nice to have a Podman examples repo similar to this: GitHub - coreos/layering-examples

And then have like a LAMP stack and some other of the usual stuff (and Plex!), and it’d be a nice way to show off Quadlet

Toolbx has a community maintained repo that’s filling a nice role. I wish I had time to volunteer but can’t so figured I’d toss it out there. Or if this exists already even better!


Does this help you?

With the above tutorial you are installing a complete lamp-stack with Podman and containers.

1 Like