real-world interview questions on PHP Deployment

🌍 PHP Deployment – Interview Questions

🟢 🟢 Beginner Level (Basic Understanding)

1. What is deployment?

👉 Moving your project from local machine to a live server.


2. Difference between localhost and live server?

  • Localhost → your system (XAMPP/WAMP)
  • Live server → accessible via internet

3. What is shared hosting?

  • Multiple websites share same server resources

4. What is VPS?

  • Virtual Private Server with dedicated resources

5. What is a domain name?

  • Website address (example.com)

6. What is DNS?

  • Converts domain → IP address

7. What is cPanel?

  • GUI to manage hosting (files, DB, email)

8. What is public_html?

  • Root folder where website files are stored

🟡 Intermediate Level (Practical Knowledge)

9. How do you deploy a PHP project on shared hosting?

👉 Expected Answer:

  • Upload files to public_html
  • Create database
  • Update config file
  • Import DB
  • Test site

10. How do you connect domain to hosting?

  • Update nameservers OR
  • Add A record

11. What is .env file?

  • Stores environment variables (DB, API keys)

12. Why should .env not be public?

  • Contains sensitive data

13. How do you migrate database?

  • Export → Import using phpMyAdmin

14. What is SSL?

  • Secures site with HTTPS

15. How do you force HTTPS?

👉 Using .htaccess:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

16. What is FTP?

  • File transfer protocol (FileZilla)

17. What is Git?

  • Version control system

18. How do you deploy using Git?

  • Push to GitHub
  • Pull on server

🔵 Advanced Level (Real Job Questions)

19. How do you deploy a Laravel project?

👉 Expected:

  • Upload project
  • Run composer install
  • Setup .env
  • Generate key
  • Run migrations

20. What is CI/CD?

  • Continuous Integration / Continuous Deployment

21. What are common deployment mistakes?

  • Wrong DB credentials
  • Missing .env
  • Permissions issue
  • Debug mode ON

22. What file permissions are required?

  • 755 → folders
  • 644 → files

23. How do you secure a PHP application?

  • Input validation
  • Prepared statements
  • Hide sensitive files
  • Use HTTPS

24. What is rate limiting?

  • Limits number of requests per user/IP

25. What is caching?

  • Store data to improve speed

26. What is CDN?

  • Content Delivery Network (Cloudflare)

27. What is load balancing?

  • Distribute traffic across servers

28. What is zero downtime deployment?

  • Deploy without breaking live site

29. How do you handle errors in production?

  • Turn OFF error display
  • Log errors instead

30. What is difference between Apache and Nginx?

  • Apache → process-based
  • Nginx → event-based (faster)

🔴 Scenario-Based Questions (Very Important)

31. Website not loading after deployment. What will you check?

👉 Expected flow:

  • Domain pointing
  • File location (public_html)
  • DB connection
  • Error logs

32. Database connected locally but not on server?

  • Check DB name/user/password
  • Host (localhost vs remote)

33. Website showing 500 error?

  • Check error logs
  • .htaccess issue
  • PHP version mismatch

34. Images not loading?

  • Wrong path
  • Case sensitivity (Linux issue)

35. Site working but slow?

  • Enable caching
  • Optimize images
  • Use CDN

36. Git deployment not updating?

  • Forgot git pull
  • Cache issue

🟣 Bonus (HR + Practical Mix)

37. Have you deployed a live project?

👉 Always say YES + explain steps


38. Which hosting have you used?

  • Hostinger / cPanel / VPS

39. How do you take backup?

  • cPanel backup
  • DB export

40. What will you do before deploying?

  • Test locally
  • Remove debug
  • Backup

🎯 Pro Tip (Interview Hack)

If interviewer asks:
👉 “Have you deployed project?”

Say like this:

“Yes, I deployed my PHP project on shared hosting using cPanel. I uploaded files to public_html, configured database, updated .env, and secured it with SSL. I also used Git for version control.”