Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   PHP Extension in Delphi (https://www.delphipraxis.net/30776-php-extension-delphi.html)

CmdrRicK 30. Sep 2004 08:42

Re: PHP Extension in Delphi
 
@ Sniper: Ja habe den Webserver restartet

@ Jörn: Sniper hatte da völlig recht, keine ISAPI-dll ;)

@ Chewie: Ich hab da garnix eingebunden, das hat alles das php4Delphi Toolkit gemacht

Hab nun mal ein Beispiel mit der ZendAPI direkt gemacht, das wird ca 67kb groß :)

Leider kann ich das ganze immernoch nicht mit PHP laden, hab in der php.ini 2 Einträge gemacht:

extension_dir = "D:\entwicklung\php\ext"
und
extension=phpDll.dll

danach den Apache restartet, aber geht scheinbar nix

hier mal der php code:
Code:
$module = 'extname';

if (extension_loaded($module))
{
    $str = "module loaded";

else
{
    $str = "Module $module is not compiled into PHP";
}
und in Delphi hab ich
Code:
ModuleEntry.Name := 'extname';
das ist alles aus der php4Delphi.pdf, die bei dem Toolkit dabei war

edit: evtl noch wichtig, ich verwende PHP 5.0.2

CmdrRicK 30. Sep 2004 11:11

Re: PHP Extension in Delphi
 
so, nun scheint es zu funzen :)

hab das Extension-Verzeichnis in den PATH eingetragen und die php.ini vom PHP-Verzeichnis ins Apache-Verzeichnis kopiert.

falls noch jemand Tip&Tricks zum Thema hatte, immer her damit, ansonsten bin ich erstmal glücklich :D

danke an alle Beteiligten ^^

omata 19. Sep 2006 12:59

Re: PHP Extension in Delphi
 
Hilfe....
Ich versuche verzweifelt eine PHP Extension zu erstellen.

Irgendwie klappt das aber nicht. Ich kann zwar die Dll erstellen und auch den Apache ohne Fehler starten. Die Extension wird mir dann aber nicht angezeigt (phpinfo) bzw. extension_loaded geht auch nicht.

Was mach ich falsch?

Mein Dll-Code sieht so aus...
Delphi-Quellcode:
library php_mydll;

uses
  SysUtils, Windows, zendTypes, ZENDAPI, phpTypes, PHPAPI;

{$R *.res}

function rinit (_type : integer;
                module_number : integer;
                TSRMLS_DC : pointer) : integer; cdecl;
begin
  Result := SUCCESS;
end;

function rshutdown (_type : integer;
                    module_number : integer;
                    TSRMLS_DC : pointer) : integer; cdecl;
begin
  Result := SUCCESS;
end;

procedure php_info_module(zend_module : Pzend_module_entry;
                          TSRMLS_DC : pointer); cdecl;
begin
  php_info_print_table_start();
  php_info_print_table_row(2, PChar('extname support'), PChar('enabled'));
  php_info_print_table_end();
end;

function minit (_type : integer;
                module_number : integer;
                TSRMLS_DC : pointer) : integer; cdecl;
begin
  RESULT := SUCCESS;
end;

function mshutdown (_type : integer;
                    module_number : integer;
                    TSRMLS_DC : pointer) : integer; cdecl;
begin
  RESULT := SUCCESS;
end;

procedure confirm_extname_compiled (ht : integer;
                                    return_value : pzval;
                                    this_ptr : pzval;
                                    return_value_used : integer;
                                    TSRMLS_DC : pointer); cdecl;
var arg : PChar;
    str : string;
    param : pzval_array;
begin
  if ( not (zend_get_parameters_ex(ht, Param) = SUCCESS )) then
  begin
    zend_wrong_param_count(TSRMLS_DC);
    Exit;
  end;
  arg := param[0]^.value.str.val;
  str := Format(
    'Congratulations! ' +
    'You have successfully modified ext/%.78s/config.m4. ' +
    'Module %.78s is now compiled into PHP.', ['extname', arg]
  );
  ZVAL_STRING(return_value, PChar(str), true);
  dispose_pzval_array(param);
end;

function get_module : Pzend_module_entry; cdecl;
var moduleEntry : Tzend_module_entry;
    module_entry_table : array[0..0] of zend_function_entry;
begin
  if not PHPLoaded then
    LoadPHP;
  ModuleEntry.size := sizeof(Tzend_module_entry);
  ModuleEntry.zend_api := ZEND_MODULE_API_NO;
  ModuleEntry.zts := USING_ZTS;
  ModuleEntry.Name := 'extname';
  ModuleEntry.version := '0.0';
  ModuleEntry.module_startup_func := @minit;
  ModuleEntry.module_shutdown_func := @mshutdown;
  ModuleEntry.request_startup_func := @rinit;
  ModuleEntry.request_shutdown_func := @rshutdown;
  ModuleEntry.info_func := @php_info_module;
  Module_entry_table[0].fname := 'confirm_extname_compiled';
  Module_entry_table[0].handler := @confirm_extname_compiled;
  Module_entry_table[0].arg_info:=nil;
  Module_entry_table[0].num_args:=0;
  Module_entry_table[0].flags:=0;
  ModuleEntry.functions := @module_entry_table[0];
  ModuleEntry._type := MODULE_PERSISTENT;
  Result := @ModuleEntry;
end;

exports
  get_module;

end.
PHP-Version: 5.1.6

Das Thema ist ja schon etwas älter, ich hoffe mir kann trotzdem geholfen werden.

Verzweifelte Grüsse
Thorsten

omata 20. Sep 2006 15:50

Re: PHP Extension in Delphi
 
Hat keiner ne Idee?

omata 21. Sep 2006 16:57

Re: PHP Extension in Delphi
 
Sollte ich die Hoffnung aufgeben, hier dochnoch Hilfe zu bekommen?

DP-Maintenance 22. Sep 2006 00:03

DP-Maintenance
 
Dieses Thema wurde von "alcaeus" von "Programmieren allgemein" nach "Sonstige Fragen zu Delphi" verschoben.
Auch wenn das Thema schon aelter ist, es passt doch besser in eine Delphi-Sparte ;)


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:29 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz