Set up your full-stack workstation
Build the machine before the code PHP, Composer, PostgreSQL and the tools of the trade
Every module from now on assumes that PHP, PostgreSQL and their friends are installed and talking to each other. This week you set that up once, carefully, and prove it works, so that later problems are about your code and not your computer. Pick what fits your PC Linux Mint 22 Native Linux PHP from ondrej/php Code name noble Windows with WSL 2 Ubuntu 26.04 via wsl --install PHP from Ubuntu Work in ~/projects Both routes end in Linux, because the server in Module 12 runs Linux. They differ only in where a few packages come from. After this module, every command in the course is the same on both. 5432
the port PostgreSQL listens on, where psql, pgAdmin and PHP all connect
PostgreSQL runs in the background as a service. Every client reaches it at this port on localhost. If a cluster ends up on 5433 instead, an older PostgreSQL is in the way, and the lesson shows how to sort it out. psql -U walks_app -d mandlas_walks says Peer authentication failed. What fixes it? Add -h localhost to connect with the password Make walks_app a superuser Reinstall PostgreSQL 18 Show the answer Without -h, psql uses the socket, where peer authentication needs your Linux user name to match the role. With -h localhost it uses TCP, where the role's password is checked.
From install to evidence Check php -m lists pdo_pgsql Create walks_app and mandlas_walks Start php -S on port 8000 Open db-check.php and read the versions Installing is not the same as working. The test page follows the whole chain: browser to PHP's server, PHP to PDO, PDO to PostgreSQL over TCP, and back. When it shows PostgreSQL 18, everything in between works. A phpinfo page never goes on a public server, and a password never goes in code, notes or a repository.
phpinfo tells an attacker exactly what to attack. Passwords belong in your password manager and in the .pgpass file in your home folder, which libpq reads for psql and PHP alike. Now watch the video Watch how WSL 2 runs a real Linux kernel, and why projects belong in the Linux file system.
Watch the video The video is from Microsoft's own developer channel, made in 2020 by the WSL team. Its installation steps are older than today's single command, so use the lesson's. The ideas are the same.