Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

PHP Development Docker Image

This image is aimed to help developers which need to develop and test their projects in different PHP versions (specially free or open source software developers). It comes with the latest supported PHP versions plus the latest 5.3 release.

The following PHP versions are available:

  • 5.6.6
  • 5.5.22
  • 5.4.38
  • 5.3.29

This container also ships with Nginx, which integrates to the right PHP-FPM version.


Start the container:

$ docker run -p 80:80 -v ~/your-app:/var/www/your-app -d "eriksencosta/php-dev:latest"

This will expose your application through port 80, which you can then access in your web browser with the address http://localhost (or an IP address if you're using Boot2Docker).

Starting your container in this way will run your application with the latest released PHP version and will output the Nginx access logs.

To get the real value of the image and switch between the different PHP versions, start the container in interactive mode:

$ docker run -t -i -p 80:80 -v ~/your-app:/var/www "eriksencosta/php-dev:latest" /bin/bash

Use the phpenv command to switch between the installed PHP versions:

# phpenv versions
* 5.6.3 (set by /opt/phpenv/version)

5.6, 5.5, 5.4 and 5.3 are just shortcuts. phpenv let you define the global (system-wide) and local PHP version. To set it globally:

# phpenv global 5.5

To set a local version, use:

# phpenv local 5.4

To install additional PHP libraries globally with Composer:

# composer global require fabpot/php-cs-fixer:dev-master

You can start the Nginx and PHP-FPM services using the helper command webserver:

# webserver start
Starting PHP-FPM server.
Starting Nginx server.

The Zend OPCache is enabled by default. If you want to disable it, you can run the helper command opcache:

# opcache disable
The Zend OPCache was disabled.

You need to restart the webserver for the changes to take effect.
Execute: webserver restart

Note: check the Silex Docker Example application for further usage examples.

PHP Information

After starting the container, access http://localhost/info.php (or an IP address if you're using Boot2Docker).


PHP-FPM is installed for each PHP version. To start it with Nginx, use the helper command webserver. See the Usage section.

PHP Extensions

Each PHP version is built with the following extensions:

  • amqp
  • bcmath
  • Core
  • ctype
  • curl
  • date
  • dom
  • ereg
  • exif
  • fileinfo
  • filter
  • ftp
  • gd
  • hash
  • iconv
  • igbinary
  • intl
  • json
  • libxml
  • mbstring
  • mcrypt
  • memcached
  • mongo
  • mysql
  • mysqli
  • mysqlnd
  • openssl
  • pcntl
  • pcre
  • PDO
  • pdo_mysql
  • pdo_pgsql
  • pdo_sqlite
  • Phar
  • posix
  • readline
  • Reflection
  • redis
  • riak
  • session
  • shmop
  • SimpleXML
  • soap
  • sockets
  • SPL
  • sqlite3
  • standard
  • sysvsem
  • sysvshm
  • tidy
  • tokenizer
  • xdebug
  • xml
  • xmlreader
  • xmlrpc
  • xmlwriter
  • xsl
  • Zend OPcache
  • zip
  • zlib

From the previous list, the following extensions were installed using PECL:


Composer is also installed. The following libraries are installed globally:

Additional Information

The image is built using Ansible. The playbook used is the Ansible PHP Development.


Apache License 2.0


No description, website, or topics provided.




No releases published


No packages published