How to run PHP on your Windows PC for free
Run PHP on a Windows PC for free with Server by Zaweba: Apache, PHP and MariaDB in one folder, and a wizard that makes your first site in a few steps.

Running PHP on a Windows PC costs nothing if you use Server by Zaweba. It puts Apache, PHP and the MariaDB database in one folder, starts them from a control panel, and its new-site wizard makes a working site you can open in your browser within a few steps. It's free software under the EULA, works offline and needs no account.
PHP on its own is just a program that turns scripts into pages. To see those pages in a browser you need a web server in front of it, and most real sites also want a database. Wiring those together by hand means editing configuration files and hoping the paths line up. Server does that wiring for you, so you can spend the time on your own code instead.
What you need
A 64-bit copy of Windows 10 or 11 and about 557 MB of disk space. Everything Server uses sits in its own folder: the components, a data folder for configuration, databases, logs and certificates, and a www folder where new sites go. Nothing else is installed in Windows unless you allow it, such as a hosts file entry or starting with Windows.
Four versions of PHP come with it: 5.6, 7.4, 8.2 and 8.3. You don't have to pick one for the whole PC. Each site chooses its own, so an old project and a new one can run side by side.
Step by step
Open Server and look at the control panel. It has a card for each service (Apache, MariaDB and Mailpit, the mail catcher) with a status light, its ports and Start, Stop and Restart buttons. Use Start all from the Services menu to bring them all up at once. Before anything starts, Server checks its ports, and if another program already has one it names that program and offers a free port instead.
Next, make a site with the new-site wizard. Give it a name, which becomes name.test. Choose a folder: either a new one in Server's www folder or a project folder you already have. Pick the PHP version. You can also ask for HTTPS, a starter index.php that shows phpinfo, and a database for the site.
The starter page is worth ticking the first time. When the wizard finishes, open the site from the sites list with Open in browser, and the phpinfo page tells you at a glance that PHP is running and which version answered.
The name.test address needs a line in the Windows hosts file, which Server writes after a plain explanation and one Windows prompt for administrator rights. If you'd rather not give that, every site also answers on name.localhost, which Edge, Chrome and Firefox send to your own PC with no hosts entry at all.
Writing and testing your own pages
Put your PHP files in the site's folder and refresh the browser. The Open folder button on the site's card takes you straight there. Edit in whatever editor you like, save, refresh, and the change shows.
If a page needs a database, the Databases page makes a new database and user in one click, with a random password shown once for you to copy. Adminer opens already logged in, so you can make tables without typing any connection details. And if your script sends email with mail(), it lands in Mailpit's web page rather than anyone's inbox.
When something goes wrong, the Logs page shows each PHP version's error log along with Apache's and MariaDB's, following new lines as they arrive. That's usually the quickest way to see why a page came up blank.
Things to know before you start
Everything Server runs listens on 127.0.0.1, which means only your own PC can reach your sites and databases. Nobody else on your network can see them, and no firewall prompt appears. The services run while the app is open or sitting in the notification area; they aren't Windows services.
PHP 5.6 and 7.4 are end of life. They're included so older projects can still be tested, but new work belongs on 8.2 or 8.3.
If you're completely new to this, Help, then Getting started, opens a short guide inside the app covering the first steps: starting the services, making a site, and the choice between the hosts file and name.localhost. Once one site works, the next takes a minute.