PHP Interview Questions

By   |

On this page I will compile a list of questions which a person should know to handle a PHP interview. These are based on my personal experience.

PHP is gaining ground and number of jobs are also rising. In fact most of the companies are struggling to find good PHP candidates. In my view PHP is one of the easiest language on the EARTH, but its easiness has become its main weakness. Often people do not take it seriously, they just practice few things and go ahead with facing interviews. When companies are looking for a specific fields they need a person with good all round knowledge of the language.

Keeping this in mind I am compiling a list of normal items and questions which a person who is aspiring to be a good PHP developer should know.

  • Why PHP is suitable for web development?
  • Can we do other type of development in PHP?
  • if cookies are disabled in a browser, session will work or not? If Not, why? and if yes, do we need to something specific in php configuration?
  • What are the main different between mysql_fetch_row and mysql_fetch_array functions?
  • What is the fourth parameter of mysql_connect function and what is the use of this?
  • How you normally handled page permissions?
  • What is different between hashing and encryption?
  • Can I retrieve my password from a site which store password in md5 format?
  • What are the security issues if we enable super globals in our php.ini file?
  • What the major issues you have faced while working with GD library? (This question validate candidate’s real experience)
  • What is the difference between explode and split?
  • Which PHP Framework you have used mostly?
  • What is the use of “global” identifier?
  • What the magic functions in PHP?
  • Does PHP 4 have any magic functions?
  • How can I send  http referer information in my curl request?
  • How can I send attachment with my email?
  • How can we work with different language in PHP?

(Few questions are tricky questions and really don’t have any answers)

15 Questions about Magento Ecommerce System

I am enlisting 15 questions related to Magento ecommerce system. If you can answer these questions, you can consider yourself as a good beginner in Magento.

To understand Magento you should cover at least following areas :

  • Store Management
  • Product Management
  • Category Management
  • Inventory Management
  • Understanding of product variables
  • Layout and themes
  • Cache Management
  • Backup and Restoration of Backup
  • Extension Overview

1. What is Magento and how it is different from other e-commerce solutions available in the market?
2. How to create new Magento extensions?
3. How to override Magento functions?
4. How you can change the layout of a site?
5. What is store concept in Magento? Can we launch multiple stores from same domain?
6. How we can increased the speed of a Magento application?
7. What is Magento cache? How we can control it?
8. Can we setup out own cache engine? How?
9. How to change the Magento admin password if you forgot it?
10. What steps you will take to upload a Magento site to a different domain?
11. Examples of some popular extensions? How they can be installed in Magento?
12. What are hardware requirements for Magento?
13. How you can create multiple thumbnails of product or item images?
14. Can you integrate a new payment gateway to Magento? How?
15. Can you change the flow of checkout? How?

26 questions about Object Oriented Programming in PHP

1. What is object oriented programming?
2. How PHP supports object oriented programming? Tell us about syntax etc.
3. What are main features and benefits of object oriented programming?
4. How object oriented programming is different from procedural programming?
5. What is inheritance? How it is implemented in PHP?
6. How multiple inheritance can be implemented in PHP?
7. What are differences between PHP 4 and PHP 5 in regards to object oriented programming?
8. What is encapsulation and how it helps writing modular applications in PHP?
9. What is the constructor and destructor in PHP in regard to Object oriented programming?
10. What is reflection?
11. What are object iterators?
12. What do you mean by call by value and call by references?
13. What are magic functions? How they can be used?
14. What is serialization? How it affect the object oriented programming in PHP?
15. What are different types of access modifiers available in PHP?
16. What happen if we omit the access modifiers declaration from our classes?
17. What are the differences between interfaces and abstract classes?
18. What do you mean by calling a function statically?
19. How can we call parent functions of a class?
20. What are ‘sleep’ and ‘wakeup’ functions?
21. What is method overloading?
22. How method overloading can be achieved in PHP?
23. What are class constants?
24. What is autoloading in PHP?
25. What is static calling of functions in Object oriented programming?
26. How can we port a PHP 4 class to PHP 5?

44 questions about Database Programming in PHP

1. What is Sqlite?
2. Why sqlite is being called inbuilt database in PHP?
3. How mysql can be installed?
4. How mysql can be configured?
5. What are best features of MYsql?
6. How many types of storage engine mysql supports?
7. What is different between mysql_fetch_row and mysql_fetch_array functions?
8. How mysql databases can be optimized or repaired?
9. Can we used stored procedure and triggers in mysql? Give details.
10. How transactions can be done in mysql?
11. What are explain statements in mysql?
12. How explain statements can be used to optimize mysql queries?
13. How mysql can be configured for optimal performance?
14. How we can log slow queries in mysql?
15. How RDBMS principals has been implemented in mysql?
16. What are best options to take backup of mysql database?
17. What are common sql client available for mysql?
18. What are different column types available in mysql?
19. What is PHPmyadmin?
20. How PHPmyadmin can be used to administer mysql?
21. How myisam tables are different from innobd tables?
22. How numbers bigger than 11 digit can be handled in mysql with PHP?
23. How cascading deletes can be done in mysql?
24. How sqlite is different from mysql?
25. What are common usage of sqlite database?
26. How permission can be managed in sqlite database?
27. How table level security can be implemented in mysql?
28. What are differences between masters and slave database servers?
29. What are common problems with database server replications?
30. Describe the process through which a sqlite database can be created and connected?
31. What is the different between mysql_query and mysql_execute function?
32. What is outfile statement in mysql?
33. How we can import csv files in mysql directly?
34. How mysql_real_escape_string prevent sql injections? How it is different from addslashes?
35. How you can take the backup of a mysql database from command prompt?
36. How you can restore a database using mysql client from command prompt?
37. How we store an image or a word file in database, how?
38. What is enum data type and how this can help to optimize database?
39. What are indexes? Give some benefits and drawbacks of them.
40. What are full text indexes?
41. Can we have a sqlite database on a different server?
42. What is the difference between mysql_num_rows and mysql_affected_rows?
43. How query cache can be enabled in mysql?
44. How ‘too many connections’ can be solved and what are the reasons behind it?

13 questions about PHP configuration options

1. How PHP configurations can be changed?
2. What are major configuration values which we usually may want to change?
3. Mention the types of values which we can set in configuration values?
4. Can we use the ini_set function anywhere in our script?
5. Can we change and restore the configuration value to its original form from a script?
6. What are error reporting settings? How they affect the script?
7. What are session related settings in PHP?
8. What are database related settings?
9. How mails can be configured using configuration options?
10. How file based permissions can be managed using configuration options?
11. How can we secure the application using configuration options?
12. How we can disable the php functions in configuration?
13. What are the security risk we open by enabling register_globals?

28 questions about PHP programming in general

1. How PHP is different from other programming language?
2. What are basic and main features of PHP?
3. A brief history of PHP?
4. Can we use the PHP for desktop application development?
5. What are PHP data types?
6. How we can install the PHP on windows?
7. How we can install the PHP on Linux?
8. How we can install the PHP on Mac?
9. How PHP is platform independent?
10. How we can customize the PHP behaviour in our installation?
11. How we can install new PHP modules in our installation?
12. How Zend Engine works?
13. What are popular PHP modules?
14. How we can get information about PHP execution of a script?
15. How PHP can be used as a shell script?
16. How comparisons of variables work in PHP?
17. What are constants? How they are different from variables?
18. How time zones can be handled in PHP?
19. Why PHP usually called functional language?
20. What is ternary operator and how it has to be used? Give some examples.
21. What are binary and hexa numbers in PHP?
22. Mention common mistakes programmer usually do while working in PHP?
23. What is the safe mode in PHP?
24. What are major differences in a script execution on windows and linux?
25. How PHP error handling can be setup and monitored?
26. What are magic quotes and how they can be configured and maintained?
27. How many types of PHP blocks can be used to write php scripts?
28. What are the differences between include and require?

16 questions about File uploading and Form handling in PHP programming

1. Do we need to do something specific to do form handling in PHP?
2. How file uploading has to be enabled in a HTML form?
3. How PHP handles file uploading process?
4. What are configuration variables available in PHP for forms?
5. What configuration variables available in PHP for file uploading?
6. What are register_globals in PHP and how these are related to forms?
7. How form data can be accessed in a PHP script?
8. How form data can be secure from bad user inputs?
9. What is the different between move_upload_file function and copy/move function when both can be used in copying/moving uploaded file to a permanent location?
10. How big files upload can be handled in PHP?
11. How we can know the status of file upload progress in middle of an upload?
12. What are common security problems which arise if we enabled the file upload in PHP?
13. How we can prevent security problems associated with file upload in PHP?
14. How form status can be handled in case of multi steps forms?
15. How forms can be submitted to other server/script using PHP script only on server side?
16. How uploaded files can be stored in a databases?