30 questions for an interview of a senior PHP programmer in Beijing

Insert picture description here

Collection of interview questions:

1. Where is SESSION stored on the server?
2. How does the server obtain the client's cookie?
3. How to realize session sharing, and what is the principle of sharing?
4. Please outline the process of building LVS and what is the principle of file sharing?
5. Is the data uploaded from the network shared server to a server? More than one? How to achieve synchronization?
6. Tell us what database design paradigm you know? What are the commonly used modeling tools? (Mysql modeling tool)
7. If you are a project manager, how do you manage the daily affairs of your project team?
8. What are the basic conditions for the configuration of the master-slave database, and what needs to be configured?
9. Tell me your commonly used version of the controller, which configuration files need to be configured in SVN
10. What should LVS pay attention to before the project runs, or what problems will occur?
11. Why does ecshop have field redundancy that violates the design pattern? , Please tell why you did this?
12. Common mysql optimization methods, say as much as possible?
13. What is the principle of memcache? Can it be stored in 2M value?
14. What is a queue? Exclusive lock, how to solve Myisam deadlock?
15. Please tell me the common storage engine of mysql? The characteristics of memory storage engine?
16. How to insert more than 5000 pieces of data the fastest?
17. How many open source frameworks have you used?
18. Where is the ecshop shopping cart information stored?
19. The principle of page caching generated by PHP
20. What are the caching technologies you know, briefly introduce them separately

1. Where is SESSION stored on the server?
Answer: Specified by php.ini, it can be stored in a file in the specified directory or in the memory, or in the database!

2. How does the
server obtain the client's cookie? Answer: The server can grab the cookie with the header information and set it back every time it processes the request.

3. How to realize SESSION sharing and what is the principle of sharing?
Answer: Configure the master-slave database and store SESSION in the master database. A common practice is to install MEMCAHCE on each server and store SESSION in each MEMCACHE.

4. Please outline the process of building LVS and what is the principle of file sharing?
5. Is the data uploaded from the network shared server to a server? More than one? How to achieve synchronization?

6. Tell us what database design paradigm you know? What are the commonly used modeling tools? (Mysql modeling tool)
Answer: 1NF: Every record meets atomicity and cannot be divided; 2NF: Every record must meet uniqueness, 3NF: Fields are not redundant, sometimes we also need anti-three paradigm, commonly used modeling tools : PhpMyAdmin, navicat for mysql, DOS command line;

7. If you are a project manager, how do you manage the daily affairs of your project team?
Answer: None

8. What are the basic conditions for the configuration of the master-slave database, and what needs to be configured?
Answer: Basic conditions: two or more database servers,
configuration process: 1. Open the bin-log of the master and slave servers respectively; slave server + relaylog
2. Create a corresponding account on the master server and authorize it according to requirements;
3. Use your own slave server The created account is connected to the master server to read the binary file and synchronize after analysis.
Configuration items: master: log-bin=mysql-bin;server-id=num(int);binlog-format=mixd/statement/row/
slave: log_bin =mysql-bin;server-id=num(int)//only; relay_log=mysql-relay-bin;log_slave_updates=1;relay_only=1;

9. Tell your commonly used version controller, which configuration files need to be configured in
SVN A: SVN, GIT, CVS; Configuration file: mod_authz_svn.so mod_dav_svn.so move to the server module and load, configure permissions, assign users ;

10. What matters should LVS pay attention to before the project runs, or what problems will occur?

11. Why does ecshop have field redundancy that violates the design pattern, please tell us why?
Answer: In some circumstances, the anti-three paradigm increases efficiency, so do it!

12. Common mysql optimization methods, say as much as possible?
Answer: SQL statement optimization; storage optimization; database configuration; server configuration

13. What is the principle of memcache? Can it be stored in 2M value?
Answer: Using the C/S mode, the agreement is ordinary text, and the data is processed in the memory based on the libevent mechanism; memcache can only store 1MB of data at most, and memcache is not born for storing big data. But you can consider compressing or splitting the value into multiple values ​​and assigning them to multiple keys before storing!

14. What is a queue? Exclusive lock, how to solve Myisam deadlock?
Answer: MYisam is a table-level lock by default, so multiple actions that operate a single table at the same time can only be performed in a queue;
exclusive locks, also known as write locks, write locks to exclude other requests during SQL execution , Will be automatically released after execution;
deadlock resolution: first find the thread number of the deadlock, and then kill the thread ID

15. Please tell me the common storage engine of mysql? The characteristics of memory storage engine?
Answer: Myisam, InnoDB, memory, and memory are characterized by storing tables in memory, which is several times faster, and data is lost after restarting!

16. How to insert more than 5000 pieces of data in the fastest way?
Answer: First generate the data file and import it with sql statement

17. How many open source frameworks have you used?
Answer: TP/CI/ZF/YII

18. Where is the ecshop shopping cart information stored?
Answer: order_info; order_goods; order_action;

19. The principle of page caching generated by PHP
A: Put the cached content into the OB cache, and put it at the end of the program cache and return after the OB cache is over or the script is executed!

20. What are the caching technologies you know?
A brief introduction is given respectively. A: Ob cache, write file type cache through template technology; memcache; redis; the most significant difference between redis and memcache is that data is not only in memory, but also It will also generate files in the disk, even if you restart, the data can be loaded;

21. The principle of HTTP protocol, what is full duplex and what is half duplex?
Answer: HTTP protocol is a stateless protocol, bluntly speaking, it is request and response, full duplex refers to request and response at the same time In progress, half-duplex refers to single execution;

22. Principle of ucenter communication?
Answer: After an application is logged in, the callback file sent to the synchronized login application is polled in the background. After the callback file receives the user ID, it generates a cookie or session and enters the login mode.

23. Principle of Memcached
Answer: Memcached runs in one or more servers as a daemon, waiting to receive the connection operation of the client. The client can be written in various languages ​​(such as PHP). After PHP and other clients establish a connection with the memcached service, the next thing is to access the object. Each accessed object has a unique identifier key, and access operations are performed through this key and saved to memcached The objects in are actually placed in memory, not stored in cache files, which is why memcached can be so efficient and fast.

24. How many JS frameworks have you used? Give examples to illustrate the advantages and disadvantages
A: jQuery, prototype, dojo, ext, YUI;
jQuery: powerful DOM node query no one can do it, animation operation is convenient; DOM packaging is very good! High and low version compatibility is very good.
Prototype: earlier jS library, better support for ajax, based on the prototype chain, object-oriented is very powerful
dojo: it is easier to have WEB pages with dynamic capabilities;
ext: powerful UI operations top the list;
YUI: powerful Class library, providing many methods;

25. How to measure the use of AJAX (when to use AJAX)
Answer: AJAX is called no refresh technology, commonly used scenarios: form validation, user ratings, clicks; it can be used as long as it needs to interact with the server in real time;

26. What is push technology and what is its implementation principle?
Answer: Push technology is also called COMET, which means that the long connection is suspended on the server when the client requests it. Once the server has new data, it will be returned to the client immediately. it is good;

27. What is vertical search, and the principle of word segmentation in Sphinx?
Answer: Vertical search refers to the context of searching within a specific range. The search surface will only become more refined, not more and more extensive; the principle of sphinx word segmentation: split the text into multiple words in each document from the data source The object creates an index and stores the index table in memory!

28. What is the use of ha_sphinx.so in sphinx?
Answer: A sphinx storage module;

29. How does PHP merge arrays?
Answer: array_mergn; array_mergn_recursive;

30. Answer: Does PHP read files faster or read mysql data faster? Why?
Answer: Under normal circumstances, read files "read database; in different situations, the speed will be reversed. For example, when the amount of data in the database is very small and there are many files in the same directory, reading the database is greater than reading the file;

Insert picture description here

Guess you like

Origin blog.csdn.net/liuxingjiaoyu/article/details/112571759