The Easy way to compile and install PHP and MySQL on MacOS, Windows, and Linux.
Check out our repository full of our open-source code and our latest release:
Repository Lates Release
Open Terminal and navigate to [GITHUB-REPO-DIR]/macos/CLI/
with [GITHUB-REPO-DIR]
being the directory of this repository (cd [GITHUB-REPO-DIR]/macos/CLI/
).
Execute the install script that is inside the above directory by typing ./install.sh
. This will install Homebrew if it not already installed, install all dependencies required for compiling the PHP CLI, compile the PHP CLI itself, test the build, and then install it. Do NOT run it with sudo ./install.sh
even if you will be asked later on about your password. This is because Homebrew can't run as admin.
After PHP CLI has been successfully installed, you can check that it has applied by executing php -v
. This will show you the PHP CLI version along with the build date and other information. The build version and date is what you need to pay attention to make sure it installed correctly. You're done!
Open Terminal and navigate to [GITHUB-REPO-DIR]/debian/CLI/
with [GITHUB-REPO-DIR]
being the directory of this repository (cd [GITHUB-REPO-DIR]/debian/CLI/
).
Execute the install script that is inside the above directory by typing ./install.sh
. This will install all dependencies required to compile the PHP CLI using the Advanced Package Tool (APT), compile the PHP CLI itself, test the build, and then install it. If you so wish, you may run with sudo ./install.sh
unlike macOS in order to get asked for your admin password once at the start, so you can leave it unattended longer.
After PHP CLI has been successfully installed, you can check that it has applied by executing php -v
. This will show you the PHP CLI version along with the build date and other information. The build version and date is what you need to pay attention to make sure it installed correctly. You're done!
Navigate to [GITHUB-REPO-DIR]/macos/Docker/dockerDesktop
with [GITHUB-REPO-DIR]
being the directory of the repository (cd [GITHUB-REPO-DIR]/debian/Docker/dockerd
)
execute the install script installDockerDesktop.sh
(./installDockerDesktop.sh
). Enter your password when prompted, and wait for it to finish. This will install Docker Desktop and all dependencies. It will NOT overwrite a current install if it is found, but instead will ask you if you want it removed.
Docker.app
Navigate to your preferred MySQL Server Version directory by using cd [GITHUB-REPO-DIR]/macos/Docker/dockerFiles/mysql-[SQLVER]
with [SQLVER]
being either 5.6, 5.7, or 5.8 for the MySQL Server Version. If you are not planning to run MySQL, you can go to any of the three version directories.
Now, go into the folder of your PHP version of choice by using cd [GITHUB-REPO-DIR]/macos/Docker/dockerFiles/mysql-[SQLVER]/php-latest-[PHPVER]
with [PHPVER]
being 7.2, 7.3, 7.4, or 8.0. This corresponds to the latest patch of your PHP version of choice. If you are only planning to run the MySQL Server, you can go into any PHP version directory.
To run the server(s), you can execute startLAMP.sh
for the LAMP stack, startMySQL.sh
for just MySQL, or startPHP.sh
for just PHP/Apache. All of the scripts will asks you for the folder location that it should use to store the files for your website and/or MySQL server, and then download the appropriate Docker Images for the server of choice. This folder location will need to already exist and needs to have proper read/write access by the terminal user of the current session. The download of the Docker Images is all automated (as is everything else).
Accessing MySQL through PDO:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql<SQLVERID>
with <SQLVERID>
being 80 for MySQL 8.0, etc. inside of a terminal while the container is runningTo stop the Docker Application, open a terminal and type docker container stop [php<PHPVERID>] [mysql<SQLVERID>]
with <PHPVERID>
being 74 for php 7.4, etc. if you started a Web Server, and <SQLVERID>
being 80 for MySQL 8.0, etc. if you started a MySQL Server
Navigate to the location of the Docker Desktop binary archives at windows/dockerDesktop/
.
Open the text file that contains the password for the archives and copy it.
Go back to the aforementioned folder above and double click, or execute, dockerDesktopInstaller_.exe
.
When prompted, paste the password that you just copied into the text field and click OK. The archive should now start extracting.
After the archive has been fully extracted, execute the output file by double-clicking on it. The installation should now begin.
When prompted, restart your computer
After the computer restart and Docker starts, it will prompt you to install the WSL2 linux kernel. Install it and restart docker when prompted.
When docker has restarted, docker should be installed and available for use.
Now that docker is installed, open PowerShell (NOT Command Prompt)
Navigate to [GITHUB-REPO-DIR]/windows/dockerFiles/
Once there, you can simply type docker compose up
. This will make sure that PHP, all of its extensions, Apache, and MySQL are all installed properly. If you so choose, you can close the application using CTRL + C in the Terminal where the application is open. After the initial install, you can use docker compose up -d
. This will run the application detached, meaning it will run in the background. You can stop the container
All of your files used for a website will be stored under [GITHUB-REPO-DIR]/windows/dockerFiles/php/
. You can make a simple index.php file and whatever code you put in there will get processed by Apache. If you have an index.php or index.html file, you can access the website by typing localhost
into your browser. Any other file name can be accessed from the browser by typing localhost/[fileName.extension]
where [filePrefix.extension]
is the full file name including the extension.
Accessing MySQL through PDO:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql8
inside of PowerShell while the container is running.To stop the Docker Application, go to the directory that your Docker Application resides in, and then type docker compose stop
.
Navigate to [GITHUB-REPO-DIR]/debian/Docker/dockerd
with [GITHUB-REPO-DIR]
being the directory of the repository (cd [GITHUB-REPO-DIR]/debian/Docker/dockerd
)
execute the install script installDocker.sh
(./installDocker.sh
). Enter your password when prompted, and wait for it to finish. This will install Docker and all dependencies
Navigate to [GITHUB-REPO-DIR]debian/Docker/dockerd
with [GITHUB-REPO-DIR]
being the directory of the repository (cd [GITHUB-REPO-DIR]/debian/Docker/dockerd
)
Execute startDocker.sh
(./startDocker.sh
) to start Docker and then press CTRL + C to break out of the window. DON'T WORRY. Docker will continue to run in the background.
Navigate to your preferred MySQL Server Version directory by using cd [GITHUB-REPO-DIR]/debian/Docker/dockerFiles/mysql-[SQLVER]
with [SQLVER]
being either 5.6, 5.7, or 5.8 for the MySQL Server Version. If you are not planning to run MySQL, you can go to any of the three version directories.
Now, go into the folder of your PHP version of choice by using cd [GITHUB-REPO-DIR]/debian/Docker/dockerFiles/mysql-[SQLVER]/php-latest-[PHPVER]
with [PHPVER]
being 7.2, 7.3, 7.4, or 8.0. This corresponds to the latest patch of your PHP version of choice. If you are only planning to run the MySQL Server, you can go into any PHP version directory.
To run the server(s), you can execute startLAMP.sh
for the LAMP stack, startMySQL.sh
for just MySQL, or startPHP.sh
for just PHP/Apache. All of the scripts will asks you for the folder location that it should use to store the files for your website and/or MySQL server, and then download the appropriate Docker Images for the server of choice. This folder location will need to already exist and needs to have proper read/write access by the terminal user of the current session. The download of the Docker Images is all automated (as is everything else).
Accessing MySQL through PDO:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql<SQLVERID>
with <SQLVERID>
being 80 for MySQL 8.0, etc. inside of a terminal while the container is running.To Stop the Docker Application, open a terminal and type docker container stop [php<PHPVERID>] [mysql<SQLVERID>]
with <PHPVERID>
being 74 for php 7.4, etc. if you started a Web Server, and <SQLVERID>
being 80 for MySQL 8.0, etc. if you started a MySQL Server.
Navigate to [GITHUB-REPO-DIR]/RHELCentOS/Docker/dockerd
with [GITHUB-REPO-DIR]
being the directory of the repository (cd [GITHUB-REPO-DIR]/RHELCentOS/Docker/dockerd
)
execute the install script installDocker.sh
(./installDocker.sh
). Enter your password when prompted, and wait for it to finish. This will install Docker and all dependencies
Navigate to [GITHUB-REPO-DIR]RHELCentOS/Docker/dockerd
with [GITHUB-REPO-DIR]
being the directory of the repository (cd [GITHUB-REPO-DIR]/RHELCentOS/Docker/dockerd
)
Execute startDocker.sh
(./startDocker.sh
) to start Docker and then press CTRL + C to break out of the window. DON'T WORRY. Docker will continue to run in the background.
Navigate to your preferred MySQL Server Version directory by using cd [GITHUB-REPO-DIR]/RHELCentOS/Docker/dockerFiles/mysql-[SQLVER]
with [SQLVER]
being either 5.6, 5.7, or 5.8 for the MySQL Server Version. If you are not planning to run MySQL, you can go to any of the three version directories.
Now, go into the folder of your PHP version of choice by using cd [GITHUB-REPO-DIR]/RHELCentOS/Docker/dockerFiles/mysql-[SQLVER]/php-latest-[PHPVER]
with [PHPVER]
being 7.2, 7.3, 7.4, or 8.0. This corresponds to the latest patch of your PHP version of choice. If you are only planning to run the MySQL Server, you can go into any PHP version directory.
To run the server(s), you can execute startLAMP.sh
for the LAMP stack, startMySQL.sh
for just MySQL, or startPHP.sh
for just PHP/Apache. All of the scripts will asks you for the folder location that it should use to store the files for your website and/or MySQL server, and then download the appropriate Docker Images for the server of choice. This folder location will need to already exist and needs to have proper read/write access by the terminal user of the current session. The download of the Docker Images is all automated (as is everything else).
Accessing MySQL through PDO:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql<SQLVERID>
with <SQLVERID>
being 80 for MySQL 8.0, etc. inside of a terminal while the container is running.To Stop the Docker Application, open a terminal and type docker container stop [php<PHPVERID>] [mysql<SQLVERID>]
with <PHPVERID>
being 74 for php 7.4, etc. if you started a Web Server, and <SQLVERID>
being 80 for MySQL 8.0, etc. if you started a MySQL Server.
This product includes PHP software, freely available from http://www.php.net/software/