Install PHP extensions from a web interface

Hello guys, I’m looking to make my life easier…

I think this might interest you…

I have a multiple container installation or structure behind a reverse proxy container…

The containers behind the reverse proxy are apache + php containers… which can host more than one project through vhost.

The problem I am facing is:

  1. I would like to manage (install, remove, update) PHP extensions from a graphical web interface, similar to this:

Note: I haven’t found anything to help me install CPanel inside PHP containers to manage extensions for each project’s sites.

  1. Save configuration (disable/enable extensions) per project: “site-enable” / VHost.

If you know of any web/graphic interface that helps me achieve this, tell me.

This would be the hypothetical structure that I am implementing:

Docker Network
│
└── Proxy Server Container: Manage Custom URL like https://test.dock 
    ├── MySql Server
    ├── PhpMyadmin
    ├── php 7.2
    ├── php 8.2
    ├── PhpMyadmin
    ├── Project 1 server: code repository (API Point to php 7.2)
    ├── Project 2 server: code repository (API Point to php 8.2)
    ├── Project 3 server: code repository (Laravel Project Point to php 7.2)
    └── Project 4 server: code repository (Synfony Project Point to php 8.2)

In the previous ypothetical structure you can see that I have two containers, one with PHP 7.2 and the other with 8.2, the idea is to manage the extensions individually in each container, this should be achieved by entering the urls: https://ext.7.2.dock and https: //ext.8.2.dock

When you go to https://ext.7.2.dock you should be able to see two projects/sites:

  1. API-Project-7.2
  2. Laravel-Project-7.2

At this point API-Proyect-7.2 and Laravel-Proyect-7.2 in theory are being executed by the PHP-7.2 container through the vhost implementation… the problem is that even though the php-7.2 container has all the extensions… not all of them must be enabled or they will be the same for API-Proyect-7.2 and Laravel-Proyect-7.2

This is not how containers work or I should probably say this is not how we use containers. You will always have a container filesystem. Even if you install an extension in the container, you will lose it when you delete the container and you can start everything from scratch. Containers should be deletable and recreatable. It would mean that you would need to build a new image after you choose a new extension and preferrably push it to a registry so you don’t lose it when anything happens to your machine. In theory, you could make a webinterface that can help you create a new image with the chosen extensions and then start a container from that webinterface chosing the previously buitlimage, but I would not try to modify a running container. I don’t know if anyone made a control panel for this, because I don’t think I would use it so I never searched for it

I wonder, how is this question related to Docker Hub? You created the topic in the Docker Hub category and you even added the “dockerhub” tag, yet you didn’t mention Docker Hub at all.

I agree with you and I consider that I am not using the philosophy of the founders of docker.

Now I would like to question your words.

The philosophy or way in which docker should initially be used is written in stone?

I consider that I am taking a step beyond the capabilities that docker has.

I am creating a public project for developer, that allows you to create multiple project structures, and that at the same time allows you to share images or allows you to share projects on different plataforms.

I have another post here in the community about this project in which I ask the community for support but no one has written anything about it.

Each project has a yml file, the problem is that every time I wanted to build this project anywhere I would have to touch the dependencies in the container terminal, adding extensions and adding things that I wouldn’t want to be doing…

It is not about writing it in stone, but about what makes sense and what not as much. Docker can be used for many things sometime we start to use one tool for everything even if it means much more work, because it can do something that we really like. In practice, you either use a server which is persistent and you can manually install everything if you want to and use control pannels that make changes or use a container image to start a container which should be deletable any time and recreated by running the same command that was used to create it first. You expect the same result. Whenever you want to add a new port to the container, you have to recreate it and you lose the data written in the container. A PHP extension is not something that you can put on a volume or a bind mounted folder to make it persistent, since extensions can require system dependencies and you can’t put the whole container on a volume.

That’s why I wrote you would need to build a new image for each different combination of PHP extensions and run the container from that. All I was saying is that I would not change the running container but creating the image would be fine. If someone builds something that can install extensions in the container and detect when the container is deleted and automatically install everything again while showing some progressbar maybe, that’s fine too for development.

Maybe there is such a tool, I don’t know, but the fact that I don’t know is not an opinion. If there is no such a tool, that could mean the audience is not big enough or nobody thought about it yet.

I made my PHP Docker project once that supports choosing which extensions you want to install in the image (not the container) which could be called from a controll panel too, and I also found someone who made scripts to support adding extensions even more easily, but I never remember that. If anyone knows about that, feel free to share it here.

I remember that topic, but it felt long and I was too tired to read it. I feel the same now so maybe later.

I respect your opinion, but…

There is something to correct here; Yes, you can have a LAMP stack server with all the extensions installed… but these must be mostly disabled, and it is through .htaccess or within the same virtual host of each individual project where they should be enabled.

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/example
    
	# added by Extension Manager
    php_value extension=mi_extension.so 

</VirtualHost>

or .htaccess:

php_flag mysqli on

And although I haven’t tried it yet, I think I can:

  1. add new shared volumes to the network/docker environment.
  2. and have it point to the new volume via a vhost update and make it a project.
  3. I also think it’s possible to pass a backing Json file in the build yml file that lists the extensions for the specific project, something like composer.json --requirement (not docker-compose) or use one by default project…

I think it is possible, if those tools did not exist I would have to create them. There is no other path for me, and I didn’t come asking if it is right or wrong, I just wanted to know if something like that exists, yes or no… not to get into a debate of concepts that will lead nowhere to me.

Although it doesn’t make sense to you, it does to me… I want to be able to control my development environment and attach new projects, without having to add new containers, specific images that consume more resources, in specific cases attach these to the existing containers. . very similar to a shared host.

If I have to share my projects with other users, I can generatively offer the configuration files so that the user can recreate an individual image that does not depend on my tool. I can also offer the same to be imported into the tool. that I am creating.

Here is an example of the two buttons:

image

If there is a tool (web interface) that allows me to manage the extensions (install, update, remove), for the specific version / image like: “php:8.2-apache-bulleyes” it would shorten my development path, since I would only have than attaching it to the stack lamp container… the only drawback is that it adapts to configuring the project in vhost or .htaccess…

Thank you very much for trying to discourage me from the goal.

I have found something that I will try to adapt to Docker and my tool: PHP Configuration | Webmin