Home  >  Article  >  Backend Development  >  php module learning one php module initial exploration_PHP tutorial

php module learning one php module initial exploration_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:27:33792browse


It turns out that writing php module is not very difficult. The reference articles include: Write your own php extension function zend manual. This article mainly talks about the compilation process 1. Find the source code of php and decompress it (if it is already installed, use Original installation source code) 2 Use the tool "ext_skel" to initialize the module code. This tool has written some necessary code for you. Tool location: /ext/ext_skel Usage: ext_skel --extname=Module name First enter /ext/ directory, and then execute-------------./ext_skel --extname=my_module-------------This tool will create the directory for you under ext/ Create a directory with the same name as the module and create some relevant code. 3 Modify the config.m4 file file location: /ext/module name/config.m4 Modification method: Remove a few lines of comments related to the module (3 lines) (remove dnl, optional with, enable, I chose with, Because there are fewer letters: P) 4 Modify the generated code and create your own function. How to modify this part? You can refer to the zend manual to create your own functional function. I added a function weiping(); output "welcome to my homepage: http://www .wmsp.org" The specific method is explained in detail in Yorgo Su's article 5 Return to {phpsrc} Running tool buildconf Sometimes you may use buildconf --force to force execution 6 configure Reconfigure ./configure --with-module name 7 make Needless to say, just run make. 8 Test and write a test function in your module, and then use the newly compiled php to execute it. 9 Recompile apache and add the new php module libphp4.a. Next article: php module learning ( 2) Zend engine analysis (to be continued) Related articles: config.m4 buildconf

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531881.htmlTechArticleIt turns out that writing php module is not very difficult. The reference articles include: Writing your own php extension function zend manual This article mainly talks about the compilation process 1. Find the source code of php,...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn