In order to start using Linux for PHP, you must install Docker on your computer first. Please read the Docker documentation for further details.
Once Docker is installed, please enter the following command to run the Linux for PHP image with the non thread-safe version of PHP 7.4.2 :
You can now run any PHP script from the command line. Once you are done with the container, please quit the container by typing :
And, what if you wish to run a PHP application from a Web browser and start the Linux for PHP container in Docker's detached mode? To do so, enter the following command :
You should now be able to access any of the PHP scripts contained in your project folder by pointing your browser to http://localhost:8181.
Finally, what if you want to compile and use a different version of PHP? In a new terminal window, enter the following command, making sure you enter the version that you wish to compile (8.0.0dev in this example) :
Alternatively, you could also decide to do it manually. If so, start by running a Linux for PHP base image containing the PHP source files with the following command :
And, on the container's command line interface (CLI), checkout the version of PHP you wish to compile and begin compilation by entering the following commands (in our example, we will compile from master) :