PHP kernel learning-01-preparations. I haven't written anything about PHP for a long time. This time, let's talk about PHP kernel-related knowledge. According to the management, before we begin to explain, we should first prepare the environment: environment preparation: 1. Linux environment has not written anything about PHP for a long time. This time we will talk about the knowledge of PHP kernel.
According to the management, we should first prepare the environment before starting the explanation:
Environment preparation:
1. in Linux, we can use both ubuntu and debian systems.
2. php source code. The php source code is php-5.4.13.tar.gz. you can download the code from the php official website.
3. webserver uses nginx and the database is mysql
The php source code must be prepared. nginx and mysql can be installed selectively.
After the PHP source code is downloaded, decompress the source code. let's take a look at the directory structure of the Source Code First:
Build: mainly files related to source code compilation.
Ext: PHP extension source code path
Main:
Zend: zend Engine Implementation Directory
Pear: php extension and Application Repository
Sapi: various server abstraction layer codes, such as apache and nginx
TSRM: thread security Resource Manager
Test: test code
To view the source code, we use vim + ctags. if you do not understand what this is, please baidu.
Knowledge preparation:
Many macro definitions are used in PHP source code. before getting started, we should first review macro-related knowledge.
1. Double # This is the connector in C language. let's take a look at an example and you will understand it.
# Define TEST (name) hello _ # name
Let's take a look at the result of the call: TEST (world): hello_world
Do you understand!
2. let's take a look at #, which is used to add double quotation marks before the value after the macro variable is replaced. let's look at an example.
# Define TEST (str) # str
Let's take a look at the call: printf (TEST (hello world); the result is printf ("hello world ");
3. # The line command is used to change the current row number and file name.
4. there are also some commonly used macros which will be introduced later.
Bytes. According to the management, we should first prepare the environment: environment preparation: 1. Linux environment...