General Interview Interview questions PHP

How to PHP/ LAMP light screen interview ?


45 to 60 minutes format interview – Screen Interview

5 minutesIntroduction – Interview
25 minutesTechnical (6 questions)
5 minutesBehavorial (2 questions)
5 minutesPersonality (2 questions)
5 minutesQuestions for us
15 min buffer

Assessment Grid

Front end
readable code
Optimal code
reusable code
passionated ? up to date with latest ?
perseverance / determination
problem solver
collaboration team
work ethic

Behavorial Question

tell us about your latest ‘coding’ project ?
Tell me about a stressful situation at work and how you handled it.
Describe a time when you disagreed with your supervisor on how to accomplish something.
Have you ever had to convince your team to do a job they were reluctant to do?
Have you ever had a deadline you were not able to meet? What happened? What did you do?
Tell me about a time your co-workers had a conflict. How did you handle it?
How have you prioritized being assigned multiple projects?
Tell me about a difficult work challenge you’ve had.
Talk about a time when you had to adapt to big changes at work.
How have you dealt with an angry or upset customer?
Have you ever gone above and beyond to help a customer? What did you do?
Tell me about a time when you had to fight for an idea at work.
Talk about a time where you had to make an important decision quickly. What did you decide? What were the results?
Have you ever been in a business situation that was ethically questionable? What did you do?
Have you ever had a project that had to change drastically while it was in progress? Why? How did you do it?
Talk about a time when a co-worker was not doing their share on a project. How did you handle it?
Tell me about a major setback you’ve had. How did you deal with it?
What have you done when colleagues have been stressed out by a project?
Talk about a difficult problem you’ve had to solve. How did you solve it?
Have you ever had to defend a customer’s point of view? What did you do? Why?
Talk about a time when you’ve had to sell an idea to your colleagues.
Tell me about a problem you solved in a creative way.

Personality Question

If you could change one thing about your personality, what would it be and why?
What are your sports and hobbies outside of work?
Do you prefer working on your own or in a team? Why?
What are you most passionate about?
Can you tell me about a time when you went above and beyond in your job?
How would your best friend describe you?
What makes you unique?
Tell me about a time when you came up with a creative solution to a challenging task. What was the result?
How do you handle stress at work?
How do you feel when someone interrupts you during a task?
Tell me about a time when you disagreed with a manager or colleague about a decision. How did you handle it?
What is your favorite book and why?
Can you name one professional achievement and one personal achievement?
Which superhero would you want to be and why?
What is your greatest fear?

PHP Questions

What is difference between abstract class and interface ?
What is difference between PUT and PATCH ?
tell us about your latest ‘coding’ project ?
What are the steps to create a new database using MySQL and PHP?
30. How to create API in PHP?
Explain type hinting in PHP
Explain the main types of errors.
Do they follow any PHP convention standard of programming ?
Are you familiar with CodeSniffer
Are you familiar with PHPUnit
Do you use Composer? If yes, what benefits have you found in it?
What does MVC stand for and what does each component do?
do you know some design pattern ?
factory pattern ?
interface ?
Factory ?
singleton ?
How do you handle PHP upgrades ?

Javascript Questions

what is nodeJS
Have you used any JS framework ? is yes what are they ?

Database Questions

Q #7) Explain Normalization and De-Normalization.


Normalization is the process of removing redundant data from the database by splitting the table in a well-defined manner in order to maintain data integrity. This process saves much of the storage space.

De-normalization is the process of adding up redundant data on the table in order to speed up the complex queries and thus achieve better performance.
8) What are the different types of Normalization?

Answer: Different types of Normalization are:

First Normal Form (1NF): A relation is said to be in 1NF only when all the entities of the table contain unique or atomic values.
Second Normal Form (2NF): A relation is said to be in 2NF only if it is in 1NF and all the non-key attribute of the table is fully dependent on the primary key.
Third Normal Form (3NF): A relation is said to be in 3NF only if it is in 2NF and every non-key attribute of the table is not transitively dependent on the primary key.

API Question

What restful api method would be appropriate for an upsert ?

Linux Question

Do you know how toi use vim / vi ?
What experience have you had with nginx ? apache ?
What is netstat command?
Explain working of env command.
44. What is pipe?

Deployment Question

Are you familiar with CI ?
Are you familiar with CD ?
Are you familiar with jenkins?
Are you familiar with Git Pull request
are you familiar with GIT branch

What is a palindrome ?

What is a palindrome ? Find the definition below from the online oxford

a word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run.

In the example below only a word palindrome could be identified. Additional conditions would be necessary to analyze phrase or sequences

function isPalindrome($str): bool
    $str_length = strlen($str);
    $mid = round($str_length / 2);
    $last_character = $str_length - 1;

    for ($i = 0; $i <= $mid; $i++) {
        if ($str[$i] != $str[$last_character]) {
            return false;
    return true;

var_dump( isPalindrome('madam'));
var_dump( isPalindrome('nursesrun'));
var_dump( isPalindrome('davad'));
var_dump( isPalindrome('avaava'));

What is the run time complexity ?

It sounds to be O(n/2)

What is the space complexity ?

We do not allocate memory except for few variables as $i, $mid and $last_character



Null Safe operator is awesome ! Great code

Awesome piece of work, imagine to replace the follwoing piece of code

$country =  null;
if ($session !== null) {
    $user = $session->user;
    if ($user !== null) {
        $address = $user->getAddress();
        if ($address !== null) {
            $country = $address->country;

by just

$country = $session?->user?->getAddress()?->country; 


Useful catch (\Throwable $e)

catch (\Throwable $e) turned out to be very useful while coding in PHP.

When Exception were caught in specific instances, catch throwable would catch anything that would impede the code to run

Example below in a phpUnit scenario :

        try {
            $r = $this->checkKeys($data);
        } catch (\Throwable $e) {
            $this->assertEquals($e->getCode(), 404);

Developer Manifesto by David Raleche

4 Principles are guiding this methodology

- Readability
- Quality Assurance
- Logic
- Reusable code


PSR-2 code styling
Function no longer than 50 lines
PHP doc Block
TypeHint your functions

More information:

For better code readability we suggest PSR-2 code styling to be applied. We consider a function bigger than 25 lines is not an efficient function. For engaging this methodology we recommend 50 lines maximum per function. DocBloc are essentials. Swagger in a case of API writing is essential to be present.
A developer should be able to explain his work easily and quickly and should use materials to do so

Quality Insurance

No PHP error message
No PHP Warning messages
No PHP Notices
No hardcore credentials
Unit Testing

When executing the code we expect the quality assurance team to verify that no PHP errors, warnings, notices are produced. We also expect the QA team to go throughout the code to verify that no hardcore credentials are present within the code. Unit Test writing should be edited by QA team preferably


DRY (do not repeat yourself)
KISS (Keep it Stupid Simple)
SOLID principles

 Reusable Code

Use PHP throw exception
Use Object oriented techniques
Use static function

Use PHP throw exception
Use Object oriented techniques
Use static function

Add the following your PHP too get rid of PHP notices, warnings

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);

Want to know more about my work around the LAMP stack world and other specialties? Sign up for our email brief for hand-picked articles, news, and more.


* indicates required


How to address the undefined function yaml_parse_file ?

Here are the steps when you encounter the error below, it means that the yaml library is missing as it is not native to php per say

undefined function yaml_parse_file

Install YAML library for PHP when you see the error below

yum search yaml

First step is to install yaml via pecl

pecl install yaml-2.0.0

Second step is to create the following file


And add the following line

echo ""

Then restart php server

service php-fpm restart

How to setup a CRON JOB for apache/httpd to restart automatically ?

Very helpful website top figure out crontab sequence*_*_*

Every 30 minutes 


  */30  *  *  *  *       root /etc/init.d/httpd restart > /dev/null 2>&1

  */30  *  *  *  *       root /etc/init.d/mysql restart > /dev/null 2>&1

Every hour


  0  *  *  *  *       root /etc/init.d/httpd restart > /dev/null 2>&1

Every minute


  *  *  *  *  *       root /etc/init.d/httpd restart > /dev/null 2>&1

Check logs 

tail n- 200  /var/log/cron

tail n- 200  /var/log/messages

Plus link here regarding dev/null 2>&1



How to use PHP DocBlock ?

 * Returns a list of XXXXXXX
 * @param string $route_group_uuid
 * @return Array $listCarrierRoute
 * @throws \Exception
 * @version 05-05-2020
 * @author David Raleche <[email protected]>
 * @reference JIRA Ticket PMM2-862 Create route groups XXXXX

What to do – PHP session slow ?


Increase memory size

memory_limit = 2048M

PHP Xcache to be light fast

yum install php xcache – light fast application

 yum install php54-xcache.x86_64