On 6/9/07, "H. Hübel" <[EMAIL PROTECTED]> wrote:
Hello everyone

for learning to develope an own external php-extension i studied the
following session under
http://devzone.zend.com/article/1021-Extension-Writing-Part-I-Introduction-to-PHP-and-Zend
and tried to develope my first extension as the examples from this site.

i use Linux (openSuse 10.2) and have compiled php 5.2.3 and apache 2.2.4
successfully.

after editing the first example of this site above (hello-world) i can
run "phpize" and "./configure --enable-hello" successfully too.

but when i run "make", i get an error message called:

susi-note:/php-5.2.3/ext/hello # make
make: *** No rule to make target `/php-5.2.3/ext/hello/hello.c', needed
by `hello.lo'.  Stop.



i just covered all lines of that example in this site described above
and changed nothing from that. i guess its usually so simple that the
authors just think, it should be to compile on every system.
so i wonder about my error result.

has anybody an idea, what i can do to compile this example?

my example is the following:

under my php-source-directory i created a subfolder under the "/ext/"
directory called "hello".

in this directory i created the following files under my footer. than i
started to typing "phpsize", "./configure..." and "make" from that
directory as described in the site called above.

thank you very much for any help!

kind regards,
h. huebel

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

config.m4:

PHP_ARG_ENABLE(hello, whether to enable Hello World support,
[ --enable-hello   Enable Hello World support])

if test "$PHP_HELLO" = "yes"; then
  AC_DEFINE(HAVE_HELLO, 1, [Whether you have Hello World])
  PHP_NEW_EXTENSION(hello, hello.c, $ext_shared)
fi

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

php_hello.h:

#ifndef PHP_HELLO_H
#define PHP_HELLO_H 1

#define PHP_HELLO_WORLD_VERSION "1.0"
#define PHP_HELLO_WORLD_EXTNAME "hello"

PHP_FUNCTION(hello_world);

extern zend_module_entry hello_module_entry;
#define phpext_hello_ptr &hello_module_entry



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


#ifndef PHP_HELLO_H
#define PHP_HELLO_H 1

#define PHP_HELLO_WORLD_VERSION "1.0"
#define PHP_HELLO_WORLD_EXTNAME "hello"

PHP_FUNCTION(hello_world);

extern zend_module_entry hello_module_entry;
#define phpext_hello_ptr &hello_module_entry

#endifsusi-note:/home/hagen/download/php-5.2.3/ext/hello # cat php_hello.c
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"
#include "php_hello.h"

static function_entry hello_functions[] = {
    PHP_FE(hello_world, NULL)
    {NULL, NULL, NULL}
};

zend_module_entry hello_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
    STANDARD_MODULE_HEADER,
#endif
    PHP_HELLO_WORLD_EXTNAME,
    hello_functions,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
#if ZEND_MODULE_API_NO >= 20010901
    PHP_HELLO_WORLD_VERSION,
#endif
    STANDARD_MODULE_PROPERTIES
};

#ifdef COMPILE_DL_HELLO
ZEND_GET_MODULE(hello)
#endif

PHP_FUNCTION(hello_world)
{
    RETURN_STRING("Hello World", 1);
}

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



   That's a bit out of the scope of this list, but a simple fix
anyway.  Change config.m4:
PHP_NEW_EXTENSION(hello, hello.c, $ext_shared)

   .... to....
PHP_NEW_EXTENSION(hello, php_hello.c, $ext_shared)

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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

Reply via email to