PHP additional questions and answers for interviews

Lecture



PHP additional questions and answers for interviews

6. Do SVN and CVS abbreviations say something?
SVN (Subversion) and CVS (Concurrent Versions System) are version control systems.
7. And what are these systems?
A version control system is software to make it easier to work with
obsessing information. A version control system allows you to store multiple versions.
of the same document, if necessary, revert to earlier versions,
to share who and when made this or that change and much more.
8. Are there any other version control systems?
Yes. Git, Mercurial, Bazaar ...
9 / html and xml- what is data parsing
10 What functions are used when parsing data, tell us the principle and scheme of work when parsing data?
11. Tell the work cycle when using the version control system.
9. What is a session? Where are the sessions stored: client side or server side?
Session (http session) is a logical object that allows you to transfer data between the
optional HTTP requests from one user. Sessions are created in PHP on the side.
server and stored there. Actually, sessions, if in a nutshell, is a mechanism that allows
uniquely identify the browser and creating a file for this browser on the server in which
The torus stores session variables.
If possible, it is better not to store a large amount of information in a session. If information
Since it’s not critical (for example, user interface settings), it’s best to keep it in
client-side cookies.
10. How long does the session live?
The lifetime of a cookie that stores the session ID is zero by default,
those. Cook is stored until the browser is closed.
11. And when the browser is open?
Tomkat default 30 minutes, but it can be customized.
12. Is it possible to somehow extend the life of the session?
Yes. This can be changed using the session.cookie_lifetime parameter in the php.ini file.
PHP usually stores session data in files. In order not to clog the file system
outdated data are periodically cleaned, garbage collection is garbage collection. AT
There is a session.gc_maxlifetime parameter in the php.ini file that indicates the time in seconds
after which all obsolete data will be deleted from the file system.
Suppose we want to set the session lifetime to 3 hours. To do this, in the file php.ini install-
We have the following parameters:
session.gc_maxlifetime = 10800
session.cookie_lifetime = 10800
13. Why do we need sessions?
The fact is that the web server does not support a permanent connection with the client, and each
The request is processed as new, without any connection with the previous ones. That is, you can not
requests from the same visitor, nor save for him variables between pro-
views of individual pages. Here, to solve these two problems, sessions were invented.
14. How are the sessions organized and how do they work?
First you need to somehow identify the browser. For this you need to give him a unique
ID and ask to transfer it with each request.
The identifier is a regular variable. For PHP, its default name is PHPSESSID.
The task of PHP is to send it to the browser so that it returns it with the following request.
A variable can be transferred only in two ways: in cookies or by a POST / GET request. PHP is
uses both options.
Two settings in php.ini are responsible for this:
session.use_cookies - if equal to 1, then PHP sends the identifier in cookies, if 0 - then no.
session.use_trans_sid if equal to 1, then PHP sends it, adding to the URL and forms, if 0 - then
not.
15. Explain the difference between HTTP GET and POST.
GET sends data to the server using a URL, and POST sends data using an HTTP body.
request.
The length of the URL is limited to 1024 characters, which will be the upper limit for data that
can be sent by GET. POST can send much larger amounts of data.
In addition, POST data transmission is safer than GET, since the secret
These data (for example, the password) are not displayed directly in the user's web client (in the
from the URL, which is almost always visible).
16. And what other methods besides GET and POST exist and what are they used for?
GET and POST are basic data transfer methods. There are PUT and DELETE, but no one
enjoys
21. What is AJAX and how does it work?
AJAX is an approach to building interactive web application user interfaces.
This consists in the “background” data exchange between the browser and the web server. As a result, with
data refresh, the webpage does not reload completely, and web applications become
faster and more comfortable.
AJAX is not an independent technology, but the concept of using several related technology
logies. AJAX is based on two main principles:
1) Using dynamic server access technology “on the fly”, without rebooting
whole page, for example:
- using XMLHttpRequest (main object);
- through the dynamic creation of child frames;
- through the dynamic creation of the tag.
2) Use DHTML to dynamically change the content of the page;
JSON or XML are usually used as the data transfer format.
22. What is JSON?
This is a text based interchange format based on javascript and commonly used
it is with this language. Like many other text formats, JSON is easy to read by people.
23. And XML?
XML is an extensible markup language that is actually a compilation of common syntax
sic rules. Text format for storing structured data
to exchange information between programs, as well as to create on its basis more
specialized markup languages ​​(for example, XHTML).
24. Give an example of an XML document .

Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Running server side scripts using PHP as an example (LAMP)

Terms: Running server side scripts using PHP as an example (LAMP)