Although you are using Docker Desktop for Windows, I moved the topic to the “Docker Engine” category from Tips & HowTos as you did not have tips, but you asked about an issue which is does not seem to be related to Docker Desktop.
Since you based your image on PHP CLI, which will not run in the foreground, you will get only an interactive shell, which will not work either, unless you run the container asking for an interactive shell support:
docker run -i -t IMAGENAME
If you want to use PHP with Apache HTTPD, you should use the FPM variant of the PHP image.
FROM php:8.2-fpm-bullseye
and connect from an Apache HTTPD container to the PHP FPM port which is usually port 9000.
Thank you, but I’m still in the dark here.
I want to use it as a webserver, not cli.
So I tried FPM, and connecting to port 9000, but I do not see my website there at localhost.
All I need is PHP 8.2 with Apache and MS SQL drivers,
Official PHP switched to NGINX, but I have so many websites running Apache (and they USE Apache too) that I can’t switch to nginx at this time.
I’ve spent so much time (weeks) to find out how to make a simple image that does this, but no succes jet.
You can find CLI, FPM and Apache variants too. I don’t see any NginX and the Apache variant means you get an Apache HTTPD server with the PHP module but I haven’t used PHP that way for a long time.
I really don’t understand the NginX part. As far as I know NginX doesn’t have PHP module, but it can connect to a PHP-FPM port similarly to Apache HTTPD.
This is the source code of the official images, yes.
I mean’t connecting from an HTTPD server (or NginX) and you connect to HTTPD (or NginX) from a web browser. IT is usually the better way, but if you are still learning how PHP works this way, then yes, you can use the Apache variant of the official image too.
Why do you think that? What do you call official PHP? This is the officia image for PHP
I’m sorry. I guess I’m wrong here. I know that at Azure the default for webapp (Linux) now is Nginx and I thought I read somewhere that this is because PHP defaults to nginx these days. I see now, as I slowly begin to understand a little more of the Linux/Docker concept, that apache can still be used from within the official docker PHP pages. Thank you.