note 63457 added to install.windows.building

From: Date: Wed, 22 Mar 2006 17:59:23 +0000
Subject: note 63457 added to install.windows.building
Groups: php.notes 
Request: Send a blank email to php-notes+get-106288@lists.php.net to get a copy of this message
4. Escribiendo el código. 4.1 Creen el archivo de cabecera hello.h, para ello hagan click en "File", "New" y en el asistente seleccionen "C/C++ Header File", en el campo "File Name" escriban "hello.h" por ejemplo. A continueación ingresen el siguiente código y graben todo el proyecto. ========================> #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 #endif <====================== 4.2 Hagan exactamente el mismo paso que con el archivo anterior, pero esta vez dejen seleccionada la opción "C++ Source File", en el campo "File Name" escriban "hello.c" por ejemplo. A continueación ingresen el siguiente código y graben todo nuevamente. ========================> #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" #include "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); } <====================== 5.3 Copien el archivo php4ts.lib que se encuentra en el ROOT de PHP hacia la carpeta del proyecto ("ext/hello/"), creo que este archivo debería ir en otro lugar pero sólo aquí andubo en mi caso (supongo que se debería modificar la lína de configuración del compilador que carga este archivo). ========= Listo, eso es todo sólo queda compilar el proyecto y poner el archvo DLL que quedó en la carpeta Release dentro de la carpeta de las extensiones de PHP, después hay que modificar PHP.INI (si no poseen permisos para ejecutar la función dl) para que cargue la extensión y reiniciar el servicio de Apache. El código siguiente puede comprobar que la librería se cargó satisfactoriamente: ======================> <? echo hello_world(); ?> <====================== Espero que les sirva. Saludos. Gabriel S. Luraschi ---- Server IP: 66.163.161.117 Probable Submitter: 200.82.56.174 ---- X-Spam-Status: Yes, hits=7.4 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HEAD_ILLEGAL_CHARS autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/install.windows.building.php Edit -- http://master.php.net/note/edit/63457 Del: integrated -- http://master.php.net/note/delete/63457/integrated Del: useless -- http://master.php.net/note/delete/63457/useless Del: bad code -- http://master.php.net/note/delete/63457/bad+code Del: spam -- http://master.php.net/note/delete/63457/spam Del: non-english -- http://master.php.net/note/delete/63457/non-english Del: in docs -- http://master.php.net/note/delete/63457/in+docs Del: other reasons-- http://master.php.net/note/delete/63457 Reject -- http://master.php.net/note/reject/63457 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#106288) next »