- SQL injection: always use prepared statements.
- XSS: escape output with
htmlspecialchars($value, ENT_QUOTES, 'UTF-8'). - Passwords: store only hashes with
password_hash(); check withpassword_verify(). Never use md5 or sha1 for passwords. - CSRF: include a secret token in forms and verify it on submit.
- Uploads: check type and size, rename files, and store them outside the web root when possible.
- Errors: turn
display_errorsoff in production and log errors instead. - Keep PHP and your packages up to date.
Frameworks like Laravel handle most of these protections for you out of the box.