Review Study Aid
The points to fix in memory before the self assessment.
Definitions you must be able to give
- WSL 2 runs a real Linux kernel in a lightweight virtual machine inside Windows.
- A package manager, apt on Ubuntu and Mint, installs packages from repositories with everything they need.
- A cluster is one running PostgreSQL server with its own data folder and port, such as 18/main on port 5432.
- A role is a PostgreSQL user, a login role may connect, and a superuser may do anything.
- A connection string packs host, port, database, user and sometimes password into one piece of text.
- libpq is PostgreSQL's client library, used by psql and by PHP's pdo_pgsql driver.
- PHP's built-in server, started with php -S, is a development web server that must never face a public network.
Commands and syntax to know
wsl --installinstalls WSL and Ubuntu, andwsl -l -vlists distributions with their WSL version.php -v,php -mandphp --inishow the version, the extensions and the settings files.composer -Vshows Composer's version and the PHP it runs on.sudo -u postgres createuser --superuser "$USER"andcreatedb "$USER"give you your own role and database.CREATE DATABASE mandlas_walks OWNER walks_app;creates the Walk Office's database owned by its role.- In psql,
\llists databases,\cconnects,\dtlists tables,\dulists roles and\qquits. pg_lsclustersshows each cluster's version, port and status.- The PDO DSN is
pgsql:host=localhost;port=5432;dbname=mandlas_walks. php -S localhost:8000 -t stack-checkserves the stack-check folder.
Rules and limits
- On WSL, projects live in
~/projects, never under/mnt/c. - Install
php8.5-cliand the extensions by name, never the plain php package, which brings Apache. - Run the Composer installer only after its SHA-384 checksum matches the published one.
- Use sudo only to install software and change system settings, never for
composerin a project. - Install
postgresql-18by number, and give the PGDG scriptnobleon Linux Mint 22. ~/.pgpasslines read host:port:database:user:password, and the file needs permissions 600.- No password belongs in code, notes or a Git repository.
Distinctions not to confuse
- Peer authentication matches your Linux user name over a socket, while scram-sha-256 checks a password over TCP.
- Without
-hpsql uses the socket, and with-h localhostit uses TCP. psql --versionis the client's version, andSHOW server_version;is the server's.- "Peer authentication failed" means the wrong kind of connection, while "password authentication failed" means a wrong password.
- "could not find driver" means pdo_pgsql is missing, not that the database is down.