Re: Loading PHP Module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Problem solved.

I found a discrepency in the source code I copied from the tutorial -
completely my own typo.



                                                                                                               
                    Takahiro_Horie                                                                             
                    @nidek.com            To:     php-windows@xxxxxxxxxxxxx                                    
                                          cc:                                                                  
                    08/30/2004            Subject:      Loading PHP Module                            
                    11:28 AM                                                                                   
                                                                                                               
                                                                                                               




Hello,

I'm trying to create custom PHP 5.0.1 extensions for Windows XP and Apache
2.0.50. I was able to compile a sample extension (from a tutorial written
for PHP 4). The article is
http://www.devarticles.com/c/a/Cplusplus/Developing-Custom-PHP-Extensions-Part-1/


I ran into the problem where dl() can't be used on a multithreaded server.
That is OK.

I added extension=php_devarticles_mod.dll to my php.ini file. I restarted
Apache, and it gave me this error:

    "PHP Startup: Invalid library (maybe not a PHP library)
'php_devarticlesmod.dll"

I'm not sure what to do, or how to figure out what went wrong. Is there
some way of knowing what exactly caused the loading to fail?

Source code for php_devarticlesmod.dll is below.

Thanks in advance!
----------------------------------------------------------------

/* 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>");
}
}

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux