Hello All,
I am a beginner to PHP. I tried the following link "http://www.devarticles.com/c/a/Cplusplus/Developing-Custom-PHP-Extensions-Part-1/2/" to build a extension called php_devarticles.dll. I was successfully able to build it through Visual Studio 6.0
The hello_world.c which was a part of dll building looked like this --
/* include standard header */
/* you will need to include this in all of your php extension projects*/
#include "php.h"
/* All the functions that will be exported (available) must be declared */
ZEND_FUNCTION(hello_world);
PHP_MINFO_FUNCTION(devarticlesmod);
/* Just a basic int to be used as a counter*/
int i;
/* function list so that the Zend engine will know what’s here */
zend_function_entry devarticlesmod_functions[] =
{
ZEND_FE(hello_world, NULL)
{NULL, NULL, NULL}
};
/* module information */
zend_module_entry devarticlesmod_module_entry =
{ STANDARD_MODULE_HEADER,
"DevArticles",
devarticlesmod_functions,
NULL,
NULL,
NULL,
NULL,
PHP_MINFO(devarticlesmod),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES };
#if COMPILE_DL_DEVARTICLES_MOD
ZEND_GET_MODULE(devarticlesmod)
#endif
PHP_MINFO_FUNCTION(devarticlesmod)
{
php_info_print_table_start();
php_info_print_table_row(2, "DevArticles Extension", "All Systems Go");
php_info_print_table_end();
}
ZEND_FUNCTION(hello_world)
{
for(i=0;i<5;i++)
{
zend_printf("Hello World<br>");
}
}
When I build it and add to the ext directory where other dlls are present , and in php.ini I include extension=php_devarticlesmod.dll and also uncomment (just an example) extension=php_ldap.dll
But during the IIS start-up i get the following error.
[14-May-2009 20:49:04] PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'php_devarticlesmod.dll' in Unknown on line 0
Please can anybody help me to tell wats wrong in this.
just add more information:
<?
echo phpinfo();
echo sqrt(9);
?>
works
but php_devarticles.dll has a function called hello_world() --
<?
hello_world();
?>
Does not work