A website is not secure simply because it works. Rapidly developed or AI-assisted PHP projects can miss authorization, upload validation, contextual output encoding, prepared statements, CSRF, session and secret-management controls. This guide explains what to review and why without teaching exploit payloads.
Code-generation tools accelerate development but do not automatically know your production trust boundaries, framework version or deployment policy. A functional upload endpoint can still lack authorization, MIME validation or safe storage.
Review the complete route → middleware → controller → storage → database flow. Authentication confirms identity; authorization must independently confirm access to each resource.
OWASP recommends allowlisted extensions, server-side file-type validation, generated filenames, size limits, authorized uploaders and storage outside webroot where possible.
A “block .php” blacklist alone is weak. Review double extensions, server handlers, MIME/signature validation, filename normalization and whether uploaded content can execute.
XSS prevention depends on contextual output encoding. HTML body, attribute, JavaScript, CSS and URL contexts require different handling; rich HTML needs a trusted sanitizer.
Admin panels can also be XSS targets through customer names, product descriptions, comments, search terms or log viewers. CSP is defense in depth, not a replacement for correct encoding.
PDO can still be used unsafely if user input is concatenated into SQL. OWASP recommends parameterized queries/prepared statements as a primary defense.
Dynamic identifiers such as sort columns need allowlists. Apply least privilege to the database account to reduce impact if an injection flaw exists.
$sorgu = $pdo->prepare("SELECT id, ad FROM kullanicilar WHERE email = :email LIMIT 1");
$sorgu->execute([':email' => $email]);Directly combining user input with shell_exec, system, exec, passthru or proc_open is high risk. OWASP recommends avoiding OS commands when a language/library API can do the job.
If command execution is truly required, use a fixed executable and argument schema, allowlists, least-privileged service identity and timeouts. One escaping function is not a complete design control.
Authentication tells you who the user is; authorization decides whether that user may access a specific object. Query every protected resource in the current user/tenant scope rather than trusting a numeric ID.
Administrative actions need server-side role/permission checks. Hiding a button in the UI is not authorization.
Because browsers automatically send session cookies, state-changing endpoints need appropriate CSRF defenses. Tokens, SameSite cookies and Origin/Referer checks can be combined depending on architecture.
Prioritize delete operations, email/account changes, privileged role changes and file uploads. Avoid changing server state through GET requests.
Use Secure, HttpOnly and appropriate SameSite cookie settings, rotate session IDs after login, invalidate sessions on logout and rate-limit authentication. MFA is strongly recommended for privileged accounts.
Store passwords with password_hash/password_verify using current algorithms, never plain text, MD5 or SHA1. Reset tokens should be single-use, short-lived and unpredictable.
Do not expose .env, .git, SQL dumps, ZIP backups, logs or debug stack traces in public webroot. Keep API keys and database credentials out of repositories.
Production should disable verbose debug output while keeping protected technical logs available to operators.
According to the official PHP support table in August 2026, PHP 8.2 is in security support and 8.3, 8.4 and 8.5 are supported branches. PHP 8.1 reached end of life in December 2025.
Upgrade through staging and compatibility testing rather than blindly changing runtime versions. Frameworks, Composer packages and plugins also need their own EOL/CVE lifecycle management.
Grant write access only where required; do not make the entire project 777. Disable script execution in writable upload/cache areas where practical.
Separating web-server, PHP-FPM pool and deployment identities can limit impact. Restrict administrative services with firewall/VPN/IP policies when possible.
The review covers authentication/authorization, upload flows, input/output handling, database access, filesystem, command execution, secrets, dependencies and server configuration. Static findings are validated against actual application flow.
Controlled negative tests may be used only on an explicitly authorized staging copy to verify that security controls reject unsafe input. The report includes severity, affected endpoint/file, remediation guidance and retest status.
General status based on the official PHP support schedule in August 2026. If your distribution vendor backports fixes, also verify that vendor's lifecycle policy.
Standard cases are usually scheduled for a 24–72 hour analysis window after pre-assessment. Timing varies with file count, log access, malware spread and application architecture.
Important note: Only test systems you own or are explicitly authorized to assess.
No. It still needs the same secure review and testing discipline before production.
No. Use layered allowlist, type/signature, filename, storage, authorization and execution controls.
Correct prepared statements are strong protection; unsafe concatenation can still reintroduce risk.
No. It is defense in depth; contextual encoding and sanitization are still required.
The official PHP lifecycle shows 8.1 reached EOL on 18 December 2025.
External review is possible, but source access provides much stronger coverage for code-level issues.