Git Product home page Git Product logo

docker-php-5.3-alpine's Introduction

PHP 5.3 alpine based images

PHP 5.3 reached EOL on 14 Aug 2014 and thus, official docker support was dropped. I still needed to run 5.3 with FPM so I built this image based on the latest official builds of PHP.

Images

This repo provides the following images:

  • cespi/php-5.3:cli-latest
  • cespi/php-5.3:apache-latest
  • cespi/php-5.3:fpm-latest

All images are build from alpine 3.4 following the same criteria used to build current php library docker images

Images with additional PHP modules commonly used

Selected modules are commonly used by our organization. This images are:

  • cespi/php-5.3:modules-cli-latest
  • cespi/php-5.3:modules-apache-latest
  • cespi/php-5.3:modules-fpm-latest

How we use it

We define a bash script to work using php cli as follow:

  1. Place the scripts from this repo at vendor/bin in $HOME/bin/
  2. Set an env variable named PHP_CLI_DOCKER_IMAGE with the image of a docker php cli image. For example: PHP_CLI_DOCKER_IMAGE=cespi/php-5.3:modules-cli-latest
  3. Set an env variable named PHP_SERVER_DOCKER_RUN_OPTIONS with additional docker run arguments.

You can then add this variables to your environment editing your .bash_profile or .bashrc, or instead use direnv, so you can personalize a docker environment per project.

Install scripts

Run the following command:

mkdir -p $HOME/bin && \
  curl https://raw.githubusercontent.com/Desarrollo-CeSPI/docker-php-5.3-alpine/master/vendor/bin/php -s \
  > $HOME/bin/php && chmod +x $HOME/bin/php && \
  curl https://raw.githubusercontent.com/Desarrollo-CeSPI/docker-php-5.3-alpine/master/vendor/bin/php-server -s \
  > $HOME/bin/php-server && chmod +x $HOME/bin/php-server

Make sure $HOME/bin is the first entry on your $PATH

If php-server gives the following error:

Variable PHP_SERVER_LOCAL_PHP_INI must be set with a valid php ini file. It now
points to /home/car/bin/etc/docker/php/php.ini, but file seems to not exist

You must set PHP_SERVER_LOCAL_PHP_INI with a valid php ini file

Sample personalization per project using direnv

PHP_CLI_DOCKER_IMAGE=cespi/php-5.3:modules-cli-latest
PHP_SERVER_DOCKER_RUN_OPTIONS="--add-host local.docker:172.17.0.1 -e APACHE_RUN_USER=$USER -e APACHE_RUN_GROUP=`id -ng $USER` -v $HOME/docker/php/php.ini:/usr/local/etc/php/conf.d/my-custom-php.ini:ro"

Then, in any directory you can run php scripts or php-server script to launch a php web server

docker-php-5.3-alpine's People

Contributors

chrodriguez avatar greenled avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-php-5.3-alpine's Issues

file_put_contents not working. Permission denied

Hi,

The console shows several messages with permission problems. Like this...

PHP Warning: file_put_contents(/var/www/html/fileNotExist.log) [function.file-put-contents]: failed to open stream: Permission denied in ...

I've tried adding this in my Docker file, but the problem persist.

FROM cespi/php-5.3:apache

RUN set -x ; \
    addgroup -g 1000 -S www-data ; \
    adduser -u 1000 -D -S -G www-data www-data ; \
    set -x ; \
    addgroup -g 1000 -S nobody ; \
    adduser -u 1000 -D -S -G nobody nobody ; \
    set -x ; \
    addgroup -g 1000 -S apache ; \
    adduser -u 1000 -D -S -G apache apache ;

mod_rewrite not working

Hi, thank you very much for your work.

I'm trying to run a command from the docker-compose file but this seems to break the process.

docker-compose.yml

version: "2"

services:

  php:
    image: cespi/php-5.3:apache
    volumes:
      - ./app/:/var/www/html
    ports:
      - "80:80"
    # command: sh -c "echo Hello" # exited with code 0
    command: sh -c "echo Hello; apache2-foreground" # runs the server without mod_rewrite

app/index.php

<?php phpinfo(); ?>

apache2-foreground does wakes up the server but mod_rewrite is not working.

image

How can I maintain the same behaviour from your image with the command parameter?

cespi/php-5.3:modules-apache not getting AllowOverride

Hi. I see apache2-foreground script for images cespi/php-5.3:apache and cespi/php-5.3:modules-apache is different:

docker run cespi/php-5.3:apache sh -c "cat /usr/local/bin/apache2-foreground" | grep 'envsubst' --

envsubst '${PORT},${APACHE_RUN_USER},${APACHE_RUN_GROUP},${APACHE_DOCUMENT_ROOT},${DIRECTORY_OPTIONS},${ALLOW_OVERRIDE}' < /usr/local/etc/httpd.conf.tpl > /etc/apache2/httpd.conf

docker run cespi/php-5.3:modules-apache sh -c "cat /usr/local/bin/apache2-foreground" | grep 'envsubst' --

envsubst '${APACHE_RUN_USER},${APACHE_RUN_GROUP},${APACHE_DOCUMENT_ROOT}' < /usr/local/etc/httpd.conf.tpl > /etc/apache2/httpd.conf

As a result, I can only have configurable AllowOverride OR extra php modules with each image, but not both.

Is this the desired behavior or a bug?

Change Container Port.

Hi!

I'm using your image for and test and so testing portainer.
Both portainer and php-fpm use by default port 9000.

I tried to change php-fpm port but can't do it work.
Here is my configuration:

Dockerfile


FROM cespi/php-5.3:modules-fpm-latest
RUN sed -Ei 's|listen = 9000|listen = 9001|' /usr/local/etc/php-fpm.d/zz-docker.conf
RUN sed -Ei 's|;listen = 127.0.0.1:9000|listen = 127.0.0.1:9001|' /usr/local/etc/php-fpm.conf.default
RUN sed -Ei 's|;listen = 127.0.0.1:9000|listen = 127.0.0.1:9001|' /usr/local/etc/php-fpm.d/www.conf

EXPOSE 9001

CMD ["php-fpm"]

#docker-compose.yml

version: '3'
php-app:
build: './php/'
image: 'php-app:latest'
container_name: php-app
restart: always
ports:
- '9001:9001'
volumes:
- /dados/app1/volume/:/var/www/html/

docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f35c7bdffa6 php-app:latest "docker-php-entrypoi…" 8 minutes ago Up 8 minutes 9000/tcp, 0.0.0.0:9001->9001/tcp php-app

I aways see port 9000 when issue the "docker ps" command.

Thanks!

docker-php-ext-install Error

docker-php-ext-install mysql

print error info

configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!

php Postgresql in Dockerfile

Hi! How to install and enable php postgresql for php 5.3?

The error show "Fatal error: Call to undefined function pg_connect() "

Thankz

GD JPEG support

Hi, I noticed some of the most recent changes target sorting out JPEG support for the GD extension, but I've noticed that using cespi/php-5.3:modules-apache-latest as published to Docker Hub, I seem to currently get a version without JPEG support.

Is there a known issue with that tag or something else we should do to enable this feature? The Dockerfile itself seems to include the commands to build with a viable-looking jpeg-dir and I can see GD itself is definitely enabled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.