SQL Injection
Unsafe database queries can let untrusted input change what a query does.
Discover how common PHP security weaknesses work, learn to recognize the warning signs, and build safer web applications. Understand the risk. Learn the fix.
Select a category to learn what it is, why it matters, and the practical steps that reduce risk.
Unsafe database queries can let untrusted input change what a query does.
Unescaped user content may be interpreted as script in another visitor’s browser.
A severe flaw may allow untrusted input to cause server-side code execution.
Weak upload controls can expose applications to malicious files and path abuse.
Broken checks can expose accounts or data to users who should not access them.
Unsupported runtimes and old packages may contain publicly known security flaws.
A safe example of the problem pattern, followed by a defensive alternative.
Combining raw input with query text can change the meaning of SQL.
Prepared statements keep input values separate from SQL instructions.
If content is untrusted, the browser may interpret markup or script.
Context-appropriate output encoding helps display text as text.
Use this checklist when developing or reviewing your own PHP application.
password_hash() and verify with password_verify().Do not write your own cryptography. Prefer well-maintained libraries and framework security features.
Continue with official documentation and established security guidance.
Official documentation for PHP language features, configuration, and security.
OPEN PHP SECURITY ↗Practical defensive guidance for SQL, sessions, authentication, and more.
OPEN CHEAT SHEETS ↗