I haven't written anything about PHP for a long time, so let's talk about PHP kernel-related knowledge.
According to the management, we will prepare the environment before we begin to explain:
Environment Preparation:
1. Linux environment, we use Ubuntu/debian both systems can
2. PHP source code, we explain the code for PHP-5.4.13.TAR.GZ, code you can go to the PHP official web interface to download
3. webserver using Nginx, the database is MySQL
where PHP source code must be prepared, nginx and MySQL can be selectively installed
After the PHP source code download is complete, we extracted the source code, first look at the source code directory structure:
Build: Here are some files related to source code compilation
ext:php Extension Source Path
Main
Zend:zend Engine Implementation Directory
pear:php Extensions and application repositories
SAPI: Various server abstraction layer code, such as Apache,nginx, etc.
TSRM: Thread Safety Explorer
Test: Testing the Code
Source view, we use Vim+ctags, if you do not understand what this is, trouble yourself Baidu a bit.
Knowledge Preparation:
PHP source with a lot of macro definitions, before we begin, we first review the macro-related knowledge.
1. Double # # # This is a connector in the C language, so let's take a look at an example and you'll see.
#define TEST (name) hello_# #name
Let's take a look at the result of the call: TEST (World): Hello_world
Do you see it!
2. Let's take a look at the # #, the function of this symbol is to add double quotes after the value of the macro variable substitution, and we'll look at an example
#define TEST (str) #str
Let's take a look at the call: printf (TEST (Hello World)), and the result for printf ("Hello World");
3. #line This command to change the current line number and file name
4. There are also some commonly used macros, these macros we will use in the future to introduce
http://www.bkjia.com/PHPjc/477574.html www.bkjia.com true http://www.bkjia.com/PHPjc/477574.html techarticle I haven't written anything about PHP for a long time, so let's talk about PHP kernel-related knowledge. According to the management, before we start to explain the environment: Environment preparation: 1. Linux ring ...