What is PHP?
PHP is one of the most popular server-side scripting languages for developing a web application.
The full form of PHP is Hypertext Preprocessor.
There are several benefits of using PHP. First of all, it is totally free to use. So anyone can use PHP without any cost and host the site at a minimal cost.
It supports multiple databases. The most commonly used database is MySQL which is also free to use. Many PHP frameworks are used now for web development, such as Zend, CakePHP, Laravel etc. and CMS are Magento, WordPress, joomla.
What’s the latest version of php?
Stable release: 7.3.10 / September 26, 2019
When PHP 7.0 was released, it is claimed to be twice as fast as PHP 5.6. Now, PHP 7.3 is 31% faster than PHP 7.0
Taking a look at the improvements in php 7.0:
- Improved performance: It is 2x faster than php 5.0.
- Reduced memory usage.
- Abstract syntax tree.
- Consistent 64-bit support.
- Improved exception hierarchy.
- Many fatal errors converted to exceptions.
- Return and scalar type declaration.
- Anonymous classes.
- Zero cost asserts.
Rasmus Lerdorf, founder of php said “theoretically, you could turn off half the servers of data centres after upgrading to php 7.0”.
What is PEAR in PHP?
PEAR is a framework and repository for reusable PHP components. PEAR stands for PHP Extension and Application Repository. It contains all types of PHP code snippets and libraries.
What are PHP Data Types.
PHP data types are used to hold different types of data or values. PHP supports 8 primitive data types that can be categorized further in 3 types.
Scalar Types: There are 4 scalar data types in PHP.
Compound Types: There are 2 compound data types in PHP.
Special Types: There are 2 special data types in PHP.
How many types of array are there in PHP?
There are three types of array in PHP:
- Indexed array: an array with a numeric key.
- Associative array: an array where each key has its specific value.
- Multidimensional array: an array containing one or more arrays within itself.
PHP include vs PHP require
If file is missing or inclusion fails, include allows the script to continue but require halts the script producing a fatal E_COMPILE_ERROR level error.
PHP cookie is a small piece of information which is stored at client browser. It is used to recognize the user.
Cookie is created at server side and saved to client browser. Each time when client sends a request to the server, cookie is embedded with request. Such way, cookie can be received at the server side.
PHP setcookie() function is used to set cookie with HTTP response. Once the cookie is set, you can access it by $_COOKIE superglobal variable.
- bool setcookie ( string $name [, string $value [, int $expire = 0 [, string $path
- [, string $domain [, bool $secure = false [, bool $httponly = false ]]]]]] )
A persistent cookie is permanently stored in a cookie file on the browser’s computer. By default, cookies are temporary and are erased if we close the browser.
PHP Engine creates a logical object to preserve data across subsequent HTTP requests, which is known as session.
Sessions generally store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same user.
PHP session technique is widely used in shopping websites where we need to store and pass cart information e.g. username, product code, product name, product price etc from one page to another.
PHP session_start() function is used to start the session. It starts a new or resumes existing session. It returns existing session if session is created already. If session is not available, it creates and returns new session.
What is the difference between session and cookie?
The main difference between session and cookie is that cookies are stored on user’s computer in the text file format while sessions are stored on the server side.
You can manually set an expiry for a cookie, while session only remains active as long as browser is open.
How can you send email in PHP?
The mail() function is used to send email in PHP.
- bool mail($to,$subject,$message,$header);
How can we increase execution time of a PHP script?
By default, the maximum execution time for PHP scripts is set to 30 seconds
You can change the script run time by changing the max_execution_time directive in the php.ini file. When a script is called, set_time_limit function restarts the timeout counter from zero.
What are the different types of errors in PHP?
There are 3 types of errors in PHP.
- Parse Errors– This type of error occurs when the coder uses a wrong syntax in the script.
- Notices:These are non-critical errors. These errors are not displayed to the users.
- Warnings:These are more serious errors, but they do not result in script termination. By default, these errors are displayed to the user.
- Fatal Errors:These are the most critical errors. These errors may cause due to immediate termination of script.
What is htaccess in PHP?
The .htaccess is a configuration file on Apache server. You can change configuration settings using directives in Apache configuration files like .htaccess and httpd.conf.
What is the use of Apache?
Apache httpd 2.4.41 Released 2019-08-14
Apache is an open-source and free web server software that powers around 46% of websites around the world. The official name is Apache HTTP Server, and it’s maintained and developed by the Apache Software Foundation.
What is nginx?
the latest version of Nginx is 1.17.0, released on May 21, 2019.
NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
NGINX is about 2.5 times faster than Apache based on the results of a benchmark test running up to 1,000 concurrent connections. … Clearly, NGINX serves static content much faster than Apache. If you need to serve a lot of static content at high concurrency levels, NGINX can be a real help
Apache Vs NGINX 2019
The main difference between Apache and NGINX lies in their design architecture. Apache uses a process-driven approach and creates a new thread for each request. Whereas NGINX uses an event-driven architecture to handle multiple requests within one thread.
Software Development Life Cycle Models and Methodologies
The Software Development Lifecycle (SDLC) is a systematic process for building software that ensures the quality and correctness of the software built. SDLC process aims to produce high-quality software which meets customer expectations.
- Phase 1: Requirement and Analysis
- Phase 2: Feasibility study
- Phase 3: Design
- Phase 4: Coding
- Phase 5: Testing
- Phase 6: Deployment
- Phase 7: Maintenance
The Waterfall – is a cascade SDLC model
The Waterfall Model was the first Process Model to be introduced. It is very simple to understand and use. In a waterfall model, each phase must be completed before the next phase can begin and there is no overlapping in the phases.
Easy to understand
Easy to explain to the users.
Very difficult to go back to any stage after it finished.
Costly and required more time.
It is an extension of the waterfall model, Instead of moving down in a linear way, the process steps are bent upwards after the implementation and coding phase means associated test stage after every development stage, to form the typical V shape. The major difference between the V-shaped model and waterfall model is the early test planning in the V-shaped model.
This is also called “Validation and verification” model.
Simple and easy to use
Costly and required more time.
Iterative and Incremental Model
It is developed to overcome the weaknesses of the waterfall model. It starts with an initial planning and ends with deployment with the cyclic interactions in between. The basic idea behind this method is to develop a system through repeated cycles (iterative) and in smaller portions at a time (incremental), allowing software developers to take advantage of what was learned during the development of earlier parts or versions of the system. It can consist of mini waterfalls or mini V-Shaped model
The Iterative SDLC model does not need the full list of requirements before the project starts.
Produces business value early in the development lifecycle.
We can detect project issues and changes earlier.
- Requires heavy documentation.
- Follows a defined set of processes.
It refers to the activity of creating prototypes of software applications, for example, incomplete versions of the software program being developed.
- Throwaway prototyping
- Evolutionary prototyping
- Incremental prototyping
- Extreme prototyping
- Reduced time and costs, but this can be a disadvantage if the developer loses time in developing the prototypes.
- Improved and increased user involvement.
- Insufficient analysis. User confusion of prototype and finished system.s
- Excessive development time of the prototype.
- It is costly to implement the prototypes
Spiral model combines architecture and prototyping by stages. It is a combination of the Iterative and Waterfall SDLC models with the significant accent on the risk analysis.
The spiral model is favored for large, expensive, and complicated projects.Advantages:
- Estimates (i.e. budget, schedule, etc.) become more realistic as work progresses, because important issues are discovered earlier.
- Early involvement of developers.
- Manages risks and develops the system into phases.
- High cost and time to reach the final product.
- Highly customized limiting re-usability
In the agile methodology after every development iteration, the customer is able to see the result and understand if he is satisfied with it or he is not. This is one of the advantages of agile software development life cycle model. One of its disadvantages is that with the absence of defined requirements it is difficult to estimate the resources and development cost.
It can be used with any type of the project, but it needs more engagement from the customer and to be interactive. This will enable more valuable and workable piece for software early which also increase the customer satisfaction.
- Saves a great amount of cost and time for less documentation requirements
- Face to face communication and continuous inputs from customer representative leaves no space for guesswork.
- The end result is the high-quality software in the least possible time duration and satisfied customer.
- Capable of accommodating new changes or enhancements occurring during the development phase without the budget constraint
- Almost impossible to determine the effort estimation at the very beginning of the software development for full-size and complex projects
- High-risk probability when clients/end-users are unsure about requirements
- Necessitates experienced resources
A Scrum is a form of implementation of the Agile methodology that helps development teams to structure complex project requirements. To complete assigned tasks, Scrum teams work in sprints, which is a period that could last anywhere between 2 to 4 weeks.
Daily Scrum meetings are organized to help the complete team monitor progress made throughout the project up until that point.
The one in charge of the Scrum team is known as the ScrumMaster.