Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
PHP 10 questions

Security Best Practices

Learn to protect PHP apps from SQL Injection, XSS, CSRF, and remote code execution. Cover data sanitation and validation.

More PHP
Interview questions 1–10 of 10
1

What is Cross-Site Scripting (XSS) and how do you prevent it in PHP?

XSS occurs when an attacker injects malicious JavaScript into pages viewed by other users, often via unescaped...

Read answer →
2

How should passwords be hashed and verified securely in PHP?

Never store plaintext or reversibly-encrypted passwords. Use PHP's built-in password_hash() which uses bcrypt...

Read answer →
3

What is CSRF and how do you protect forms against it in PHP?

CSRF (Cross-Site Request Forgery) tricks an authenticated user's browser into submitting a request they didn't...

Read answer →
4

How do you securely handle file uploads in PHP?

Unrestricted file uploads can let attackers upload executable scripts disguised as images. Multiple layers of...

Read answer →
5

What is the difference between authentication and authorization, and how do you implement both securely?

ConceptQuestion it answersExampleAuthenticationWho are you?Login with email/passwordAuthorizationWhat are you...

Read answer →
6

What is input validation vs sanitization, and why do you need both?

ConceptPurposeExampleValidationChecks if data meets expected rules; rejects if notIs this a valid email format...

Read answer →
7

What security headers should a PHP application send and why?

HeaderProtects againstContent-Security-PolicyXSS by restricting script/resource sourcesX-Frame-Options: DENYCl...

Read answer →
8

How do you securely store and manage sensitive configuration like API keys?

Sensitive credentials should never be hardcoded in source code or committed to version control. Use environmen...

Read answer →
9

What is command injection and how do you prevent it in PHP?

Command injection happens when user input is passed unsanitized into shell execution functions, letting attack...

Read answer →
10

What is insecure deserialization and how do you avoid it in PHP?

PHP's unserialize() can instantiate objects and trigger magic methods (__wakeup, __destruct) from attacker-con...

Read answer →