Simple PHP extension (i)

Source: Internet
Author: User

Hello Word extensiondownload PHP7 source code into ext directory using Ext_skel script to generate the extension framework
Modify the Config.m4 to remove the dnl in front of the Php_arg_with .; Add a function declaration in the PHP_.....H header file, open the function declared by the. c file, add a function in the extension function functions array, expand the directory execution phpize generate the executable script configure,executes the./configure specifies that the default installation of the PHP directory does not need to be specifiedMake performs a makefile build. So shared library; modify PHP.ini Last increase
[array_square_sum]extension=array_square_sum.so
Run script test extension functions, such as. So cannot be found, copy the. So file from the modules in the extended directory according to the quoted directory.php-f test.php
PHP warning:php startup:unable to load Dynamic Library '/usr/lib/php/20151012/array_square_sum.so '-/USR/LIB/PHP/2 0151012/array_square_sum.so:cannot open Shared object file:no such file or directory in Unknown on line 0[email protected]:/usr/local/src/php-7.0.1/ext/array_square_sum/modules$ lsarray_square_sum.so test.php[email protected]:/usr/local/src/php-7.0.1/ext/array_square_sum/modules$ cp array_square_sum.so/usr/lib/php/ 20151012; Print out Hello World

Simple PHP extension (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.