2

I have successfully compiled Apache x64 then I use PHP 5.3.29 and 5.4.45 release x86 on it and get error that DLL files are not a valid Win32 application. I installed Visual Studio 2008 SP1, Visual C++ 2008 (x64 and x86).

List of files that I use:

1, php-5.3.29-src.zip and php-5.4.45-src.zip I took it on windows.php.net

2, instantclient-sdk-win64-10.2.0.5.zip and instantclient-sdk-windows.x64-11.2.0.4.0.zip on Oracle.

Compile steps:

call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86_amd64 (I tried using the commands in Visual Studio Tools, it also got the same error)
cd /D C:\php-sdk (I extracted the source file and renamed the directory into php-sdk)
buildconf --force
configure --enable-snapshot-build --disable-isapi --enable-debug-pack --without-mssql --without-pdo-mssql --without-pi3web --with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared --enable-object-out-dir=../obj/ --enable-com-dotnet=shared --with-mcrypt=static --disable-static-analyze
  1. The above command I took from the command line of php released x86 on phpinfo().
  2. I unzipped instantclient-sdk-win64-10.2.0.5.zip then created an oracle directory in php-sdk, moved the extracted folder, and then renamed it to instantclient10.
  3. instantclient11 I got it from instantclient-sdk-windows.x64-11.2.0.4.0.zip, doing the same thing as above.

Then use: nmake snap

But I encountered an error:

c:\php-sdk\zend\zend_execute.h(234) : warning C4267: 'function' : conversion fro
m 'size_t' to 'int', possible loss of data
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\BIN\x86_amd64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\BIN\nmake.exe"' : return code '0x2'
Stop.

Then I tried removing --enable-snapshot-build on configure, this time I just used nmake. And I encountered another error:

ext\mysqlnd\mysqlnd_net.c(31) : fatal error C1083: Cannot open include file: 'zl
ib.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\BIN\x86_amd64\cl.exe"' : return code '0x2'
Stop.

I think the problem is related to zlib, I added --disable-zlib to configure. This time, the construction process succeeds. However, I only get php5ts.dll, php_com_dotnet.dll, php_oci8.dll, php_oci8_11g.dll, php.exe and php-cgi.exe. There is no DLL files in root (build output directory) and ext folder.

Can someone give me a complete build guide like x86 release?

I would appreciate your help.

  • Windows Server 2008, Windows 7, PHP 5.3, PHP 5.4 and Visual Studio 2008 are all end of life. Voting to close. – Esa Jokinen May 10 '20 at 07:46
  • 1
    Thank you for these beautiful insults. Questions here on Server Fault should demonstrate reasonable practices on business environments. Using outdated server software isn't among them. Support for Windows Server 2008 has ended in January 2020, PHP 5.3 has been unsupported since August 2014 and PHP 5.4 since September 2015. – Esa Jokinen May 10 '20 at 08:54

1 Answers1

2

It seems your problem is mixing 64-bit Apache with 32-bit PHP. That's not possible.

You could run a separate 32-bit PHP with PHP-FPM or FastCGI. FastCGI has been available in all PHP 5.x versions and PHP-FPM since 5.3. But you should really upgrade to a supported PHP version: as of May 2020, PHP 7.3 & 7.4 have active support and PHP 7.2 security support.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
  • Yes, I know the error is because I use PHP x86 on Apache x64. But because on windows.php.net there are only x86 versions of PHP 5.3 and 5.4, so I have to recompile their own x64 version and encounter the above errors. I know they are no longer supported, but not everything can be upgraded easily, I need them to be able to upgrade to a higher version. – Tần Quảng May 10 '20 at 16:30