Background
Break News
How to add local font to Tailwind Css and NextJS? - Tutorial Design Pattern? - Blockchain Technology, How to create own Bitcoin virtual currency - Zustand mordern management state - Design Pattern - Flyweight Pattern? - Docker Full training Topic

How to create Docker file and docker compose file for Apache, PHP 8.4 for running CakePHP 5 (Part 1)

Wednesday, 8 January 2025
|
Read: Completed in minutes

How to create Docker file and docker compose file for Apache, PHP 8.4 for running CakePHP 5 (Part 1)

Hello everyone, welcome to Webzone tech tips blog, I am Zidane. Today I will sharing my experience how to create Docker file and docker compose file for Apache, PHP 8.4 for running CakePHP 5

First I am access on the https://book.cakephp.org/ and check a requirement, i got below information


CakePHP has a few system requirements:

HTTP Server. For example: Apache. Having mod_rewrite is preferred, but by no means required. You can also use nginx, or Microsoft IIS if you prefer.

Minimum PHP 8.1 (8.4 supported).

mbstring PHP extension

intl PHP extension

SimpleXML PHP extension

PDO PHP extension

How to create Docker file and docker compose file for Apache, PHP 8.4 for running CakePHP 5 (Part 1)

So I will create a Docker file with this one

We will setup some library curl, unzip, mbstring, intl simplexml, pdo for make sure can work on CakePHP 5 as requirement above

How to create Docker file and docker compose file for Apache, PHP 8.4 for running CakePHP 5

Docker file detail content

FROM php:8.4-apache

RUN apt-get update && apt-get install -y \

    libonig-dev \

    libicu-dev \

    libxml2-dev \

    libzip-dev \

    curl \

    unzip \

    git \

    && docker-php-ext-install mbstring intl simplexml pdo pdo_mysql zip \

    && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \

    && apt-get clean \

    && rm -rf /var/lib/apt/lists/*

RUN a2enmod rewrite

WORKDIR /var/www/html

EXPOSE 80

Above command already integrated with compose, PHP 8.4 also.

After this one you can try to make a docker-compose.yml with below code

How to create Docker file and docker compose file for Apache, PHP 8.4 for running CakePHP 5 (Part 1)

docker-compose.yml detail content

version: '3.8'

services:

  app:

    build:

      context: .

      dockerfile: Dockerfile

    ports:

      - "8822:80"

    volumes:

      - ./src:/var/www/html

    environment:

      - APACHE_RUN_USER=www-data

      - APACHE_RUN_GROUP=www-data

      - APACHE_LOG_DIR=/var/log/apache2


- The volumes contain the source code will be ./src

- You can use command docker compose up -d for start this docker, compose

- After that you can use the compose, php on docker

by checking command docker exec -it <container_id> bash

Enjoy everyone!

Thanks for reading. Any feedback and questions. Leave your comment on below How to create Docker file and docker compose file for Apache, PHP 8.4 for running CakePHP 5 (Part 1), we can discuss about it.

✋✋✋✋ Webzone Tech Tips - I am Zidane, See you next time

πŸ™‡πŸΌπŸ™‡πŸΌ We Appreciate Your Comments and Suggestions - Webzone, all things Tech Tips web development
Popular Webzone Tech Tips topic maybe you will be like it - by Webzone Tech Tips - Zidane
As a student, I found Blogspot very useful when I joined in 2014. I have been a developer for years . To give back and share what I learned, I started Webzone, a blog with tech tips. You can also search for tech tips zidane on Google and find my helpful posts. Love you all,

I am glad you visited my blog. I hope you find it useful for learning tech tips and webzone tricks. If you have any technical issues, feel free to browse my posts and see if they can help you solve them. You can also leave a comment or contact me if you need more assistance. Here is my blog address: https://learn-tech-tips.blogspot.com.

My blog where I share my passion for web development, webzone design, and tech tips. You will find tutorials on how to build websites from scratch, using hot trends frameworks like nestjs, nextjs, cakephp, devops, docker, and more. You will also learn how to fix common bugs on development, like a mini stackoverflow. Plus, you will discover how to easily learn programming languages such as PHP (CAKEPHP, LARAVEL), C#, C++, Web(HTML, CSS, javascript), and other useful things like Office (Excel, Photoshop). I hope you enjoy my blog and find it helpful for your projects. :)

Thanks and Best Regards!
Follow me on Tiktok @learntechtips and send me a direct message. I will be happy to chat with you.
Webzone - Zidane (huuvi168@gmail.com)
I'm developer, I like code, I like to learn new technology and want to be friend with people for learn each other
I'm a developer who loves coding, learning new technologies, and making friends with people who share the same passion. I have been a full stack developer since 2015, with more than years of experience in web development.
Copyright @2022(November) Version 1.0.0 - By Webzone, all things Tech Tips for Web Development Zidane
https://learn-tech-tips.blogspot.com