Skip to content

Commit e09821e

Browse files
committed
[Archive Nov2015] php 5.3
1 parent 9fb68d9 commit e09821e

5 files changed

Lines changed: 111 additions & 2 deletions

File tree

.docker/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM orsolin/docker-php-5.3-apache
2+
MAINTAINER Jgauthi <github.com/jgauthi>
3+
4+
VOLUME ["/var/www"]
5+
6+
# Install composer
7+
RUN curl -sSk https://getcomposer.org/installer | php -- --disable-tls && \
8+
mv composer.phar /usr/local/bin/composer
9+
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
14+
RUN a2enmod rewrite
15+
16+
WORKDIR /var/www/html
17+
EXPOSE 80
18+
CMD ["/usr/local/bin/run"]

.docker/apache_default.conf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<VirtualHost *:80>
2+
# The ServerName directive sets the request scheme, hostname and port that
3+
# the server uses to identify itself. This is used when creating
4+
# redirection URLs. In the context of virtual hosts, the ServerName
5+
# specifies what hostname must appear in the request's Host: header to
6+
# match this virtual host. For the default virtual host (this file) this
7+
# value is not decisive as it is used as a last resort host regardless.
8+
# However, you must set it for any further virtual host explicitly.
9+
ServerName php53.local
10+
11+
ServerAdmin webmaster@localhost
12+
DocumentRoot /var/www/html
13+
14+
<Directory /var/www/html>
15+
Options Indexes FollowSymLinks MultiViews
16+
AllowOverride All
17+
Require all granted
18+
</Directory>
19+
20+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
21+
# error, crit, alert, emerg.
22+
# It is also possible to configure the loglevel for particular
23+
# modules, e.g.
24+
#LogLevel info ssl:warn
25+
26+
ErrorLog /dev/stdout
27+
CustomLog /dev/stdout combined
28+
29+
# For most configuration files from conf-available/, which are
30+
# enabled or disabled at a global level, it is possible to
31+
# include a line for only one particular virtual host. For example the
32+
# following line enables the CGI configuration for this host only
33+
# after it has been globally disabled with "a2disconf".
34+
#Include conf-available/serve-cgi-bin.conf
35+
</VirtualHost>
36+
37+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

.docker/run.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
4+
phpversion=5
5+
6+
PHP_ERROR_REPORTING=${PHP_ERROR_REPORTING:-"E_ALL"}
7+
sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php$phpversion/apache2/php.ini
8+
sed -ri "s/^error_reporting\s*=.*$//g" /etc/php$phpversion/apache2/php.ini
9+
echo "error_reporting = $PHP_ERROR_REPORTING" >> /etc/php$phpversion/apache2/php.ini
10+
11+
source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND

install-image.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
#set -xv
3+
4+
# Conf
5+
webdir="/var/www/html/"
6+
container="apachephp53"
7+
image="apache-php53"
8+
vhost="php53.local"
9+
10+
# Init images
11+
docker stop $container
12+
docker rm $container
13+
docker rmi $image
14+
docker build -t $image $(dirname $0)/.docker
15+
16+
# docker run -d -P \
17+
docker create -P \
18+
--name $container \
19+
--hostname $vhost \
20+
-v $webdir:/var/www/html \
21+
-e PHP_ERROR_REPORTING='E_ALL & ~E_STRICT' \
22+
$image
23+
24+
docker start $container && docker ps
25+
# echo "[Docker] Nouveau container disponible: ${container}"
26+
# echo "Pour lancer: docker start ${container}"

readme.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,42 @@ 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 run.sh
12+
chmod +x install-image.sh .docker/run.sh
1313
./install-image.sh
1414
```
1515

16+
Get the current docker IP with the command:
17+
```shell script
18+
docker inspect apachephp53 | grep '"IPAddress": "'
19+
```
20+
21+
And edit your /etc/hosts: `172.17.X.X php53.local`
22+
1623
**Installed packages:**
1724
* Ubuntu Server 12, based on ubuntu docker image
1825
* apache2
1926
* php
2027
* php-cli
2128
* libapache2-mod-php
29+
* php-curl
30+
* php-ftp
2231
* php-gd
23-
* php-mysql
32+
* php-mbstring
33+
* php-mysql, php-myqsli
34+
* php-soap
35+
* php-zlib
2436
* composer (php package manager)
2537

38+
2639
**Default Configurations**:
2740

2841
* Apache: .htaccess-Enabled in webroot (mod_rewrite with AllowOverride all)
2942
* php.ini:
3043
* display_errors = On
3144
* error_reporting = E_ALL (default, overridable per env variable)
3245

46+
For uninstall, you can use the command: `docker rm apachephp53`
47+
3348

3449
## Usage
3550

@@ -41,5 +56,7 @@ docker start apachephp53
4156
docker stop apachephp53
4257
```
4358

59+
You can check on url: http://php53.local
60+
4461
**Access apache logs**:
4562
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)