PHP and Docker - Environment Variables

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ม.ค. 2025

ความคิดเห็น • 8

  • @Thojouno
    @Thojouno 5 หลายเดือนก่อน +2

    This whole series is gold! Thank you!

  • @ozodbekjuraev9268
    @ozodbekjuraev9268 ปีที่แล้ว +2

    I don't have composer instaled on my computer. So I can't do: "composer install --ignore-platform-reqs". Why do I have to have composer installed on my computer? Aren't we using Docker?

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว +7

      Yes you can do it inside docker.
      Just run:
      docker compose exec app composer install
      You won't need --ignore-platform-reqs doing it this way

  • @DrRalphSmiffingtonIII
    @DrRalphSmiffingtonIII 10 หลายเดือนก่อน

    I hit a snag here; whenever I tried accessing the app it would just give me "Fatal error: Composer detected issues in your platform..." complaining about needing PHP 8.2 and the app having 8.1.
    I found the solution to be to remove the vendor folder and composer.lock, re-run "composer install --ignore-platform-reqs" and NOT run "composer dump-autoload" locally; I figure this is fine as we do that step as part of the PHP Dockerfile anyway?
    Excellent tutorial btw, having a great time following along!

    • @GaryClarkeTech
      @GaryClarkeTech  10 หลายเดือนก่อน +1

      Yes..composer dump-autoload will run in the container when you do the install so no need to do it locally. Nice work on figuring it out 👍

  • @thiagopetherson1268
    @thiagopetherson1268 ปีที่แล้ว

    Hello. I'm getting the following error:
    "Warning: require_once(/var/www/html/vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/public/index.php on line 5
    Fatal error: Uncaught Error: Failed opening required '/var/www/html/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/html/public/index.php:5 Stack trace: #0 {main} thrown in /var/www/html/public/index.php on line 5"
    My files are the same as yours at this point in the class. Could you help me ? Sorry my bad english. I'm from Brazil.

    • @thiagopetherson1268
      @thiagopetherson1268 ปีที่แล้ว

      I needed to add "- /var/www/html/vendor" in "docker-compose.dev.yaml (volumes)" and use "=" instead of ":" in ".env". My code worked like that.