MaaSTaaR Posted September 7, 2006 Share Posted September 7, 2006 Hello ...sorry for my bad English .My os is Ubuntu Linux and i have Bison 2.3 , Flex 2.5.31 , GCC 4.0.3 .i don't have any problem with compile php , but my problem exactly is i get this problem from config.m4 file :maastaar@MaaSTaaR:~/php-4.4.4/ext/hello$ ./config.m4./config.m4: line 1: syntax error near unexpected token `hello,'./config.m4: line 1: `PHP_ARG_ENABLE(hello, whether to enable Hello World support,'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)fihello.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_HELLOZEND_GET_MODULE(hello)#endifPHP_FUNCTION(hello_world){ char *str; str = estrdup("Hello World"); RETURN_STRING(str, 0);}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#endifwhat is the problem , and how i can solve it ? Link to comment https://forums.phpfreaks.com/topic/19967-problem-with-configm4-file/ Share on other sites More sharing options...
btherl Posted September 7, 2006 Share Posted September 7, 2006 Hi,You should not be running "./config.m4" directly. Instead, you should edit config.m4, and then run "./buildconf"These are the instructions you should follow (from extskel):"To use your new extension, you will have to execute the following steps:1. $ cd ..2. $ vi ext/hello/config.m43. $ ./buildconf4. $ ./configure --[with|enable]-hello5. $ make6. $ ./php -f ext/hello/hello.php7. $ vi ext/hello/hello.c8. $ makeRepeat steps 3-6 until you are satisfied with ext/hello/config.m4 andstep 6 confirms that your module is compiled into PHP. Then, start writingcode and repeat the last two steps as often as necessary."Good luck, and have fun :) Link to comment https://forums.phpfreaks.com/topic/19967-problem-with-configm4-file/#findComment-87553 Share on other sites More sharing options...
MaaSTaaR Posted September 7, 2006 Author Share Posted September 7, 2006 Hello ...great it's work fine now thanks :) , i have another question please .in the article (http://www.zend.com/php/internals/extension-writing1.php) the writer said "After running each of these commands, you should have a hello.so file in ext/hello/modules/" , The problem is i don't have hello.so i have hello.o only , so how i can generating the hello.so to use it as php extension ? Link to comment https://forums.phpfreaks.com/topic/19967-problem-with-configm4-file/#findComment-87608 Share on other sites More sharing options...
btherl Posted September 10, 2006 Share Posted September 10, 2006 I don't have any ".so" file for my extension either. I think it is ok. The extension still works properly.I have these files only (my extension is named c_array):c_array.c c_array.o config.m4 CREDITS php_c_array.hc_array.lo c_array.php config.w32 EXPERIMENTAL testsI am using php-5.1.6 source. Link to comment https://forums.phpfreaks.com/topic/19967-problem-with-configm4-file/#findComment-89196 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.