Views: 66
0 0
Read Time:1 Minute, 46 Second

Setup your local dev environment with Apache PHP and Phalcon in Docker following these easy steps. The dockerfile below is going through some basic steps that will consists in

Installing apache and some other utils like git, curl, openssl and install the php bin and libraries needed for downloading and compiling phalcon framework. After that is enabling the mod_rewrite and after that remove the unnecessary binaries.

FROM alpine:latest 
RUN apk add --no-cache \
    apache2-proxy \
    apache2-ssl \
    apache2-utils \
    curl \
    git \
    logrotate \
    openssl \
    git bash php php7-dev apache2 gcc \
    libc-dev make php7-pdo php7-json \
    php7-session php7-pecl-psr \
    php7-apache2 
WORKDIR /
RUN git clone "https://github.com/phalcon/cphalcon.git"
WORKDIR /cphalcon/build
RUN git checkout v4.1.3
RUN ./install
RUN echo "extension=phalcon.so" > /etc/php7/conf.d/phalcon.ini
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/httpd.conf
RUN sed -i 's/AllowOverride none/AllowOverride All/g' /etc/apache2/httpd.conf
RUN sed -i 's/#LoadModule rewrite_module modules\/mod_rewrite.so/LoadModule rewrite_module modules\/mod_rewrite.so/g' /etc/apache2/httpd.conf

RUN apk del libc-dev zlib-dev php7-dev libedit-dev musl-dev pcre2-dev ncurses-dev \
	expat xz-libs curl musl-utils make libedit zlib ncurses-libs libstdc++ pcre git bash musl argon2-libs
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2

WORKDIR /var/www/localhost/htdocs
RUN echo "<?php phpinfo(); ?>" >  /var/www/localhost/htdocs/index.php

EXPOSE 80

CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]

All you need to do is to run this command

docker build -t my-dev-env-phalcon4 .

Enjoy

If you are interested in how to setup a Phalcon project step by step follow this link

If you enjoyed this article please share and help us grow.

Learning PHP – Introduction

Learning PHP – print and echo

Learning PHP – The variables

Learning PHP – if else

Learning PHP – Arrays

Learning PHP – The loops

cc4ae2d7d0e2367495d9f75c31beef8e?s=400&d=robohash&r=g Apache PHP and Phalcon in Docker

About Post Author

brewedbrilliance.net

Experienced software architect with a spasmodic passion for tech, software, programming. With more than 20years of experience I've decided to share all my knowledge in pills through this blog. Please feel free to contact me if there is any topic that you would love to cover
happy Apache PHP and Phalcon in Docker
Happy
0 %
sad Apache PHP and Phalcon in Docker
Sad
0 %
excited Apache PHP and Phalcon in Docker
Excited
0 %
sleepy Apache PHP and Phalcon in Docker
Sleepy
0 %
angry Apache PHP and Phalcon in Docker
Angry
0 %
surprise Apache PHP and Phalcon in Docker
Surprise
0 %

Share this content:

By brewedbrilliance.net

Experienced software architect with a spasmodic passion for tech, software, programming. With more than 20years of experience I've decided to share all my knowledge in pills through this blog. Please feel free to contact me if there is any topic that you would love to cover

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x