Ever wanted to be able to compile the latest 'dev' version of PHP in about 10 minutes without the hassle of setting everything up correctly? Well, now you can, thanks to Docker and Linux for PHP!

To learn how to install Docker on your computer, please see the project's documentation: https://docs.docker.com/install/.

In order to try PHP 7.3 on the source code of one of my open source projects, I started by requesting the Linux for Composer library using Composer:

composer require --dev linuxforphp/linuxforcomposer

Then, I ran the 'linuxforcomposer.phar' file:

vendor/bin/linuxforcomposer.phar docker:run start

The 'linuxforcomposer.json' file being automatically generated for me by the previous command, I went on to modify it like so:

{
    "name": "linuxforphp/linuxforcomposer",
    "description": "A Composer interface to run 'Linux for PHP' Docker containers.",
    "php-versions": [
        "7.3.0"
    ],
    "modes": {
        "mode1": "interactive",
        "mode2": "tty"
    },
    "ports": {
        "port1": [
            "8181:80"
        ]
    },
    "volumes": {
        "volume1": "${PWD}/:/srv/www"
    },
    "script": "\"lfphp --mysql --phpfpm --apache\"",
    "thread-safe": "false"
}

After about ten (10) minutes, I saw the runit output messages being displayed in the terminal window. I closed the window, opened my favorite browser and, lo and behold, I had the latest 'dev' version of PHP running on my computer! I can now test my PHP code on port 8181, as I had requested!

PHP 7.3.0dev phpinfo page

 

Powerful stuff! May the testing begin! :)

Have a lot of fun!


Loading Conversation