Skip to content

Commit f28e6bc

Browse files
committed
[Archive Jan2018] php 5.6
1 parent e09821e commit f28e6bc

5 files changed

Lines changed: 28 additions & 33 deletions

File tree

.docker/Dockerfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
FROM orsolin/docker-php-5.3-apache
1+
FROM php:5.6-apache
22
MAINTAINER Jgauthi <github.com/jgauthi>
33

44
VOLUME ["/var/www"]
55

6-
# Install composer
6+
# https://github.com/mlocati/docker-php-extension-installer
7+
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
8+
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && install-php-extensions \
9+
gd \
10+
mysqli pdo pdo_mysql
11+
712
RUN curl -sSk https://getcomposer.org/installer | php -- --disable-tls && \
813
mv composer.phar /usr/local/bin/composer
914

10-
COPY apache_default.conf /etc/apache2/sites-available/default
11-
COPY run.sh /usr/local/bin/run
12-
RUN chmod +x /usr/local/bin/run
13-
RUN usermod -u 1000 www-data
15+
COPY apache_default.conf /etc/apache2/sites-available/000-default.conf
1416
RUN a2enmod rewrite
15-
16-
WORKDIR /var/www/html
17-
EXPOSE 80
18-
CMD ["/usr/local/bin/run"]

.docker/apache_default.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# match this virtual host. For the default virtual host (this file) this
77
# value is not decisive as it is used as a last resort host regardless.
88
# However, you must set it for any further virtual host explicitly.
9-
ServerName php53.local
9+
ServerName php56.local
1010

1111
ServerAdmin webmaster@localhost
1212
DocumentRoot /var/www/html

.docker/run.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

install-image.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
# Conf
55
webdir="/var/www/html/"
6-
container="apachephp53"
7-
image="apache-php53"
8-
vhost="php53.local"
6+
container="apachephp56"
7+
image="apache-php56"
8+
vhost="php56.local"
99

1010
# Init images
1111
docker stop $container
@@ -21,6 +21,11 @@ docker create -P \
2121
-e PHP_ERROR_REPORTING='E_ALL & ~E_STRICT' \
2222
$image
2323

24-
docker start $container && docker ps
24+
docker start $container
25+
if [ -f "$webdir/composer.json" ]; then
26+
docker exec -it $container composer install
27+
fi
28+
29+
docker ps
2530
# echo "[Docker] Nouveau container disponible: ${container}"
2631
# echo "Pour lancer: docker start ${container}"

readme.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ A Docker image based on Ubuntu, serving PHP 5 or 7 running as Apache Module. Use
99
You can choose the php version with [tags](https://github.com/jgauthi/poc_docker_apache_php/tags). Then, you can the configuration on "conf section" on file install-image.sh.
1010

1111
```shell script
12-
chmod +x install-image.sh .docker/run.sh
12+
chmod +x install-image.sh
1313
./install-image.sh
1414
```
1515

1616
Get the current docker IP with the command:
1717
```shell script
18-
docker inspect apachephp53 | grep '"IPAddress": "'
18+
docker inspect apachephp56 | grep '"IPAddress": "'
1919
```
2020

21-
And edit your /etc/hosts: `172.17.X.X php53.local`
21+
And edit your /etc/hosts: `172.17.X.X php56.local`
2222

2323
**Installed packages:**
2424
* Ubuntu Server 12, based on ubuntu docker image
@@ -43,20 +43,23 @@ And edit your /etc/hosts: `172.17.X.X php53.local`
4343
* display_errors = On
4444
* error_reporting = E_ALL (default, overridable per env variable)
4545

46-
For uninstall, you can use the command: `docker rm apachephp53`
46+
For uninstall, you can use the command: `docker rm apachephp56`
4747

4848

4949
## Usage
5050

5151
```shell script
5252
# Start container
53-
docker start apachephp53
53+
docker start apachephp56
54+
55+
# Use composer
56+
docker exec -it apachephp56 composer install
5457

5558
# Stop container
56-
docker stop apachephp53
59+
docker stop apachephp56
5760
```
5861

59-
You can check on url: http://php53.local
62+
You can check on url: http://php56.local
6063

6164
**Access apache logs**:
6265
Apache is configured to log both access and error log to STDOUT. So you can simply use `docker logs` to get the log output:

0 commit comments

Comments
 (0)