Public | Automated Build

Last pushed: 8 days ago
Short Description
Short description is empty for this repo.
Full Description


lnmpa-php-5.2 is a PHP-FPM Server boxed in a Docker image built by Tommy Lau.

What is in this image?

This image is a php web development environment cooked from scratch with PHP version 5.2.17. Though PHP 5.2 is obsoleted, but a lot of PHP applications are still PHP 5.2 only, such like ECShop and etc. So I cooked this image with the following features.


  • Fixed docker-php-ext-install script error while checking ext-module.ini


  • Enabled GD support with GIF, JPEG, PNG, WBMP and XBM
  • Enabled mbstring
  • Enabled mcrypt
  • Enabled mysql
  • Enabled mysqli
  • Enabled pdo_mysql
  • Enabled soap


  • Set php timezone to Etc/UTC


  • Add boot2docker permissions fix

How to use this image

Single instance mode

Get the docker image by running the following commands:

docker pull tommylau/php-5.2

Start an instance:

docker run --name php -v /path/to/web:/var/www/html -d tommylau/php-5.2

This will start an instance, and you are ready to go.

Linking with other containers

To use this image linking with MySQL, you have to have a running MySQL instance, more information about MySQL docker image, please refer to tommylau/mysql. Suppose you have a MySQL instance named mysql5.6_server, we can link it in our php instance with the name mysql like this:

docker run --name php -v /path/to/web:/var/www/html --link mysql5.6_server:mysql -d tommylau/php-5.2

Then in the instance, you can use the hostname mysql to connect to the database.

Docker Pull Command
Source Repository

Comments (9)
2 months ago

@tommylau how to active this images with mcrypt?

4 months ago

能不能给php5.2 加个 Zend Optimizer ,谢谢

5 months ago

How to display php error messages with this image ?, it just display white screen when error occured, and I got no error in docker logs.

a year ago

感謝!正好需要 5.2 來測試。

2 years ago


thank you

2 years ago


If you speaks Chinese, you can visit the following address:

用 Docker 来运行和调试 PHP 网站(一)

2 years ago

how to configure nginx and php 5.2 to display the php file

now I only display the HTML file

can you help me


3 years ago


You have to also have a nginx container to work together with this PHP 5.2.

  1. Get both tommylau/php-5.2 and tommylau/nginx by using docker pull
  2. Run PHP as mentioned above: docker run --name php -v /path/to/web:/var/www/html -d tommylau/php-5.2
  3. Run Nginx and link to php: docker run --name nginx -v /path/to/web:/var/www/html --link php:php -d tommylau/nginx
  4. Prepare a nginx conf file, and have php-fpm pointed to server php

An example Nginx config file:

server {
listen 80;

root   /var/www/html;
index  index.html index.htm index.php;

location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
    access_log   off;
    expires      1d;

location ~* ^.+\.(css|js|txt|xml|swf|wav)$ {
    access_log   off;
    expires      10m;

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass php:9000;
    fastcgi_index index.php;
    include fastcgi_params;


3 years ago

Hello, how display a index.html inside my browers after a docker run with this image please ?