TL;DR: you don't need WAMP, or Apache or Nginx in your development environment. And it's not even about docker, just standard installation with protips. 😎
Yes. Because the first thing that significantly changes between Windows and Linux or macOS is the package manager, they have apt, yum, yaourt, homebrew... Windows has nothing by default (but not for long, the future looks bright!).
But here comes Chocolatey. Yes, it's a package manager. Not official, it does not contain all the software you want. But well, it provides already a lot!
To install Chocolatey, just follow the getting started, or run this command in a terminal (launched in mode administrator).
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Now you have Chocolatey, we can install PHP. Run this in a terminal in administrator mode (right click on terminal / open as administrator):
choco install php
You probably need to restart your terminal now.
You may ask why not installing a webserver like Apache or Nginx as well, the short answer is: you don't need one.
To run your project, use in the terminal the following command:
php -S localhost:1337
php -Swill start the PHP server (for development only)
localhost:1337represents the host and the port to listen on, if you want to expose the server you will probably need to use
- The server points to the current directory by default, use the option
-tto specify a folder
You access your website on http://localhost:1337! ✨
If you're using a router (a single entry point like many frameworks nowadays), you can also specify one:
php -S localhost:1337 index.php
In a terminal as administrator:
choco install composer
Just like PHP. It is super-super-easy, open a terminal in administrator (or use wsudo 😎) and type:
choco install mariadb
You're all set. MariaDB is now available on your computer.
MariaDB will work with PHP as a replacement for MySQL perfectly. You can also use any MySQL client for that. For example, you can use PHPStorm internal client or MySQL Workbench!
But most of us are used to a very specific client (which is incredibly simple to use): phpMyAdmin.
Let's install it, it's just like the 2 previous tools!
choco install phpmyadmin # Do not forget to run it as administrator
phpMyAdmin requires some PHP extensions to be enabled before it works. This is documented in the readme of the package.
Go in the install directory of PHP (for me it's
C:\Tools\php...), you can find it with the command
php --ini. And copy/paste
Now edit this file and add (or uncomment) the following lines:
You're all set. Just run the phpMyAdmin command (it runs a php server for you!), in your terminal type the following:
And that's all folks! You have setup a complete workspace to build an application in PHP that uses MariaDB with phpMyAdmin client for MySQL! ✨
You can now access phpmyadmin in your browser on http://localhost:3333.
WAMP is old. Outdated. For example, you can't even get the very last version of PHP with WAMP.
But it also adds a webserver (apache), the default configuration is not bad to learn PHP, but when it comes to run modern applications... Well, it becomes a pain to configure properly.
The method I explain here is easy but also has a serious advantage: you understand what you're doing (when WAMP is a complete package with a complex overhead).
Hope you like it. 👋