joseluisq / alpine-php-fpm

Lightweight & optimized Multi-Arch Docker Images (x86_64/arm/arm64) for PHP-FPM (PHP 8.1, 8.2, 8.3) with essential extensions on top of latest Alpine Linux. :elephant:
Apache License 2.0
185 stars 46 forks source link

Correr php con el server local. #11

Closed ssheduardo closed 1 year ago

ssheduardo commented 1 year ago

Vi tú ejemplo de como correr con el servidor local en una solo línea pero me decidí a pasarlo a un docker-compose.yml y hacer pruebas (si vi que tienes una opción de usarlo con nginx) pero como quiero hacer algo simple, bueno al lío. Tengo este docker-compose.yml

version: '3.3'
services:
    php-fpm:
        ports:
            - '8088:80'
        image: 'joseluisq/php-fpm:8.0'
        container_name: php-fpm
        working_dir: /var/www/html
        restart: unless-stopped
        volumes:
            - .:/var/www/html

Veo en los logs que esta bien, pero al ejecutar para lanzar el server local y acceder por el puerto 8088 me da error

Pero al ejecutar

dce php-fpm php -S 8088:80 -t

image

image

Qué estoy haciendo mal?

joseluisq commented 1 year ago

Tienes un error en tu comando PHP. Debe ser php -S 127.0.0.1:80 -t

El asunto es que cuanto quieres ejecutar tu container usandor el comando en una línea, si te das cuenta estás a la vez invocando al servidor de desarrollo de PHP (php -S 127.0.0.1:80 -t) por eso debe funcionar.

Pero en tu docker compose al contrario no invocas ningún comando. Prueba agregar un comando al servicio php-fpm de tu archivo docker compose. command: php -S 127.0.0.1:80 -t

joseluisq commented 1 year ago

Si quieres acceder al container via el navegador por ejemplo tienes que usar un IP que tambien sea accesible. Ver el siguiente ejemplo:

version: '3'
services:
  php-fpm:
    ports:
        - '8088:80'
    image: 'joseluisq/php-fpm:8.0'
    command: php -S 0.0.0.0:80 -t .
    container_name: php-fpm
    working_dir: /var/www/html
    volumes:
        - .:/var/www/html
ssheduardo commented 1 year ago

Perfecto, ha funcionado correctamente, no se si sería de utilidad agregarlo en el REAME.

gracias.

maietta commented 1 year ago

Why is this in Spanish when the rest of the project is in English?

This causes me to not be able to track what's going on via email notifications without having to go way out of my way to work to translate.

I will have to unsub from notifications if this continues.

joseluisq commented 1 year ago

Why is this in Spanish when the rest of the project is in English?

Thanks for the reminder. Yes, this project is in English so we have to keep consistency overall. I will make sure to enforce that for future users.

This causes me to not be able to track what's going on via email notifications without having to go way out of my way to work to translate.

Sorry about that. We will offer non-english users other channels to get support in Spanish for example if the case.

I will have to unsub from notifications if this continues.

As already answered, we will keep language consistency across the project. But of course you are free to unsubscribe if think so.

maietta commented 1 year ago

Thank you for understanding. I know I may anger or upset some people but I feel that consistency quite important regardless of the language used. I'll continue to monitor the project and contribute if I can or see fit. (Especially regarding security related issues or concerns)