Why call to php extension function in c++ is showing undefine?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karimkhan
    New Member
    • Jan 2011
    • 54

    Why call to php extension function in c++ is showing undefine?

    I tried to create php extension using VS2010, wamp server and php. Project I created following the step given at : http://www.dreamincode.net/forums/to...n-for-windows/

    was successful and projectname.dll file created.
    I am using: Apache/2.2.22 (Win32) PHP/5.4.3

    I copied this dll file into path: C:\Wamp\bin\php \php5.3.5\ext and added extension=php7. dll into php.ini file also.

    I can see php7.dll is there in active php extension list.

    but when I run php file with phpinfo() then I found that extension was not successful. I used following code in .cpp file to create the extension:

    Code:
    #define PHP_COMPILER_ID  "VC6"
    
    #include "php.h"
    
    
    ZEND_FUNCTION(use_html);
    
    zend_function_entry use_functions[] = 
    {
        ZEND_FE(use_html, NULL)
        {NULL, NULL, NULL}
    };
    
    zend_module_entry use_html_module_entry = 
    {
        STANDARD_MODULE_HEADER,
        "Use Html",
        use_functions,
        NULL, NULL, NULL, NULL, NULL,
        "1.0.0-tutorial",
        STANDARD_MODULE_PROPERTIES
    };
    
    ZEND_GET_MODULE(use_html);
    
    ZEND_FUNCTION(use_html)
    {
         bool useHtml;
    
         if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &useHtml) == FAILURE)
         {
             E_ERROR;
             return;
         }
    
         if(useHtml)
         {
             php_printf("This string uses <a href='#'>Html</a>");
         }
         else
         {
             php_printf("This string does not Html");
         }
    
         return;
    }
    Now I could see "Use html" when I run phpinfo() function.

    But it is not there! What can be the problem?
Working...