Find out why a PHP file upload fails: read the error code in $_FILES, fix empty $_FILES and $_POST, raise upload_max_filesize and post_max_size (and Nginx client_max_body_size), and fix folder permissions and paths.
Fix "failed to open stream: Permission denied" and "mkdir(): Permission denied" in PHP: find the web server user, set the right owner, use 755/644 (or 775 with a shared group), handle SELinux, and why 777 is never the answer.
Fix "Allowed memory size of ... bytes exhausted" in PHP: what the numbers mean, where to raise memory_limit on Apache, PHP-FPM, CLI and WordPress, and how to stop the leak with pagination, streaming, generators and smaller images.
SQLSTATE[HY000] is a generic code: the number after it tells you the real problem. Fix the most common PDO errors in PHP: 2002 connection refused, 1045 access denied, 1049 unknown database, 2006 server gone away, 1366 and more.
Fix CORS errors in a PHP API: understand why the browser blocks the request, answer preflight OPTIONS requests, allow only your own origins, handle credentials and the Authorization header, and avoid the most common mistakes.
401 Unauthorized means the request isn't authenticated; 403 Forbidden means it is, but lacks permission. Learn when to return each in a PHP API, why the Authorization header goes missing on Apache, and how preflight requests cause false 401s.
Implement refresh tokens in a plain PHP API: short-lived JWT access tokens, random refresh tokens stored as hashes, rotation on every use, reuse detection, logout and support for both browsers (httpOnly cookie) and mobile apps.
Protect a PHP API from brute force, scraping and overload with rate limits per route and per IP: limits per endpoint, 429 with Retry-After, a Redis version, a MySQL fallback, the client IP behind proxies, and stricter rules for login.
Fix "Cannot modify header information - headers already sent" in PHP: read the file and line in the message, then remove the real cause: whitespace, a closing ?> tag, the UTF-8 BOM, an echo, a warning or an include printing HTML.
Add pagination, search and filters to a plain PHP API with MySQL: LIMIT and OFFSET, query parameters, total counts and a JSON response ready for a frontend, DataTables or a mobile app.
Build secure file uploads in a plain PHP API for images and PDFs: multipart/form-data, maximum size, the real MIME type, safe file names, a protected upload folder and JSON responses.
Version a plain PHP API with /v1 and /v2 routes: when a new version is needed, how to organize the code, share logic between versions and retire old versions without breaking integrations.
Validate the data your plain PHP API receives before saving it: JSON parsing, required fields, emails, types, 422 errors and consistent responses, with no framework.
Handle errors in a plain PHP API with consistent JSON responses for 400, 401, 403, 404, 422 and 500. Practical examples with try/catch, a custom exception and global handlers.
Learn how to prevent SQL injection in PHP with PDO, prepared statements, bound parameters and good practices that protect logins, CRUD endpoints and APIs.
Implement JWT authentication in a PHP API: login, token generation, validation and protected routes, with a complete, production-minded example and no framework.
Build a REST API in plain PHP without a framework: JSON responses, clean routes, a CRUD example, validation and Bearer token authentication. Complete, practical example.
No articles match that word. Try another term or browse the categories above.