This article needs to be used in the previous article, but it needs to be compiled into the form of a dynamic or static link library. In this article, you rename main () in the WebService client program to Testphpmodule () and return the string that is printed to the console, and the build file name is libtest.so when the compilation is complete.
I. Environmental preparedness
Copy the generated libtest.so file to the/usr/lib directory and execute the command/sbin/ldconfig
Prepare the PHP source code file and unzip it.
Second, the development of PHP Module
First into the PHP source code directory in the EXT directory, to execute the following command:
#./ext_skel--extname= Custom Module name
When the execution is complete, a folder named "Custom module name" is generated and the Config.m4 file is edited after entering this folder
Locate the following code:
dnl PHP_ARG_WITH(Test, for Test support,
dnl Make sure that the comment is aligned:
dnl [ --with-Test Include Test support])
Or
dnl PHP_ARG_ENABLE(Test, whether to enable Test support,
dnl Make sure that the comment is aligned:
dnl [ --enable-Test Enable Test support])
Remove the DNL in front of each line
If you want to pass a dynamic reference, suggest using--enable-test