I need to run php in a website on our Windows 2003 64 bit server and while php offer 32 bit binaries for Windows, they aren't offering 64 bit ones at the moment.

I can't switch IIS 6 to run 32 bit applications as it then stops all my other asp.net sites working.

What I am doing is trying to build php from source for a 64 bit target by following this guide : http://wiki.php.net/internals/windows/stepbystepbuild

I used the Windows SDK build environment command window to build this and started by issuing the command:

setenv /x64 /xp /release

..to set the build target to "Targeting Windows XP x64 RELEASE"

I issued the configure line of:

configure --disable-all --enable-cli --enable-isapi

Which results in the failure during building (it builds fine if I omit --enable-isapi which I don't want to do):

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

SAPI sapi\cli build complete
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
php5isapi.c
c:\php-sdk\php53dev\vc9\x64\php5.3\zend\zend_execute.h(234) : warning C4267: 'function' : conversion from 'size_t' to 'int', possibl
oss of data
sapi\isapi\php5isapi.c(286) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
sapi\isapi\php5isapi.c(300) : warning C4267: '=' : conversion from 'size_t' to 'DWORD', possible loss of data
sapi\isapi\php5isapi.c(789) : warning C4267: '=' : conversion from 'size_t' to 'DWORD', possible loss of data
sapi\isapi\php5isapi.c(791) : warning C4267: '=' : conversion from 'size_t' to 'DWORD', possible loss of data
sapi\isapi\php5isapi.c(863) : warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
sapi\isapi\php5isapi.c(885) : error C4235: nonstandard extension used : '_asm' keyword not supported on this architecture
sapi\isapi\php5isapi.c(885) : error C2065: 'mov' : undeclared identifier
sapi\isapi\php5isapi.c(885) : error C2146: syntax error : missing ';' before identifier 'lpPage'
sapi\isapi\php5isapi.c(885) : error C2065: 'esp' : undeclared identifier
sapi\isapi\php5isapi.c(905) : warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
sapi\isapi\php5isapi.c(908) : warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
sapi\isapi\php5isapi.c(912) : warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\x86_amd64\cl.exe"' : return code '0x2'
Stop.

This looks like the problem: "nonstandard extension used : '_asm' keyword not supported on this architecture". I suspect I have not done enough to tell the build process to provide a 64 bit output can anyone suggest how to overcome this?

link|improve this question

80% accept rate
feedback

1 Answer

up vote 1 down vote accepted

Your "_asm" refers to inline assembly language embedded in the C code.

"Inline assembly is not supported on the Itanium and x64 processors," per http://msdn.microsoft.com/en-us/library/4ks26t93(VS.80).aspx.

Therefore, you cannot simply recompile it; you would have to rework the code to remove the inline assembly code and replace it with C-language instructions. Not only would this be a lot of work, but it probably would undo the performance optimizations that were implemented using the inline assembly code. There's probably a way to use a separate assembler to build the assembly-language portions and then link them into the project, but that obviously would be light-years beyond our sysadmin realm.

I suspect that this is the reason why there is no official 64-bit build of PHP for Windows. I have heard of unofficial 64-bit Windows builds of PHP, but they are reputed to be unstable.

Have you considered setting up a separate 32-bit application pool specifically for PHP? That would enable you to run PHP in 32-bit compatibility mode without breaking your 64-bit ASP.NET applications.

link|improve this answer
Miles, I am running IIS 6 and don't seem to be able to set 32/64 bit per application pool. It looks like a server-wide setting. And setting the whole server to 32 bit stops my existing asp.net sites working at the moment. Thanks for the answer, there's just no way I am fixing up that assembly, perhaps I can drop the isapi module and go with fastcgi. – Neil Trodden Aug 20 '10 at 10:27
You're right, only IIS 7+ supports separate 32-bit and 64-bit application pools. My bad. I suppose that if you are limited to IIS6 but adding PHP support for the first time, another approach would be to run a different HTTP service (presumably Apache) on a separate port for your PHP applications. Sounds like you might already have a better path forward with FastCGI, though... – Miles Erickson Aug 21 '10 at 6:21
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.