5

Firstly this is about php4Delphi not RadPHP (formerly Delphi For PHP).

Using

  • Delphi 2010
  • PHP 5.3.6 (VC9, NTS)
  • php4Delphi 7.2 (compiled with VC9 directive)
  • Windows Server 2008 R2
  • IIS 7

When trying to run the php4Delphi delphi_math.dll example extension on the IIS/PHP server I see the following error in the C:\Windows\Temp\php-errors.log file.

[15-Jun-2011 17:58:42] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\delphi_math.dll' - A dynamic link library (DLL) initialization routine failed. in Unknown on line 0

I've already resolved the initial issue of PHP not finding my extension so it's not a path style problem.

I'm thinking that php4Delphi 7.2 may not support the latest PHP 5.3.6. Has anyone got this configuration working for them?

LachlanG
  • 4,047
  • 1
  • 23
  • 35

3 Answers3

6

PHP tries to load the module internally and fails, you are right.

The problem is not in the search path, but in the usage of the not thread safe version of php with php4delphi. When php loads an extension it receives the list of some call-back functions from the extension dll and use it for communicating with dll. The list of the parameters of the callback function for thread safe and not thread safe versions of php is different.

php4delphi was made for thread safe model of php. You can read what is the difference between TS and NTS versions here: IIS Aid. In this particular case I would recommend to change the not thread safe PHP to thread safe PHP, if possible.

If the usage of NTS PHP is a requirement, then the source code of php4delphi must be adapted and I think in this case a lot of changes are needed.

Toby Allen
  • 10,997
  • 11
  • 73
  • 124
Perevoznyk
  • 186
  • 1
  • 4
  • Thanks for looking into this and for that link about the TS/NTS versions. I was under the mistaken impression that the NTS was the traditional PHP bundling and the TS the new offering. Now that I know I had it backwards there won't be a problem with swapping to the TS PHP version. – LachlanG Jun 15 '11 at 12:12
2

I just did the test of php4delphi 7.2 with PHP 5.3.6, but the thread-safe version and the extension was loaded as expected. I think you can use NTS version only if you run your script using php.exe from the command line, not when you use IIS. Anyway, I will do the test with NTS version as well and let you know about the result.

Perevoznyk
  • 186
  • 1
  • 4
0

To me it looks like PHP itself (and not delphiphp) tries to load a module internally and that fails.

It could be that it searches for DLLs in the PATH to loadlibrary() but finds 64-bit DLLs instead of 32-bit DLLs. Best first try this setup on a 32-bit Windows system.

P.s. the 64-bit system indication I get from "program files (x86)" obviously

Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89
  • A path issue was my first problem however I resolved that by adding the PHP\ext directory to the system path (and rebooting). This was a different issue however. Thanks for your time anyway. – LachlanG Jun 15 '11 at 12:14