Resolved:
After researching, I see this problem plagues many other developers as
well.
The root cause is that the Distribution Windows Build of Apache 2.2 is
built with msvcr71.dll which is the C++ runtime dll
for Visual Studio 2003!!! But, most recent builds of python .pyd files
which link to C/C++ code, are built with msvcr90.dll which is the one
from Visual Studio 2008. As a result, Apache chokes with this obscure
error (failure to load a dll) whenever a pyd is imported that is built
with any C/C+ runtime which is not msvrcr71.dll. If you run httpd.exe
from a command prompt, you will get an error popup for Microsoft error
R6034.
In particular, if you want to used sftp in python on Apache 2.2, you
cannot do so using the distributed Windows build of Apache 2.2.
However, there are lots of postings showing how to build Apache 2.2
yourself under Visual Studio 2008, so that would be the workaround for
running web2py on a Windows platform under Apache 2.2 when you are
doing sftp or something using C/C++ code. See
http://comments.gmane.org/gmane.comp.apache.devel/43600 where it
mentions that Apache 2.4 will finally
be built with a current Microsoft C++ runtime dll.
Another workaround if you do not want to build Apache in VS 2008, is
to try to run web2py under IIS.
I got it working under IIS 7 on Vista, but yes, it is quite difficult
to do even with the easiest of the 3 methods
described in the web2py slice about IIS. The easiest method is to use
Rocket together with IIS 7, where IIS 7 is used as a proxy for
Rocket. Additional steps to take regarding what is mentioned in the
slice is to create web application in IIS 7 to serve as a kind of
surrogate for the web2py application. Plus the specifics of the
routes.py entries and of the .NET URL rewriter file
ManagedFusion.Rewriter.txt are pretty much have to discovered by
experimentation.
Here is what works for my web2py app named 'UETR' on IIS 7:
ManagedFusion.Rewriter.txt
-------------------------------------------------------
RewriteEngine On
RewriteBase /
RewriteRule ^(/)
http://138.85.50.99:8000/UETR?r=$1 [R,NC]
c:\web2py\routes.py
-----------------------
default_application = 'UETR' # ordinarily set in base routes.py
default_controller = 'default' # ordinarily set in app-specific
routes.py
default_function = 'index' # ordinarily set in app-specific
routes.py
routes_app = ((r'/(?P<app>welcome|admin|uetr)\b.*', r'\g<app>'),
(r'(.*)', r'UETR'),
(r'/?(.*)', r'UETR'))
routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'),
(r'.*:/robots.txt', r'/examples/static/robots.txt'),
(r'.*:/LTE1/index', r':8000/UETR/default/
index'),
((r'.*http:/localhost.* (?P<any>.*)', r'
http://localhost:
8000/UETR/default/index')))
routes_out = ((r'.*
http://otherdomain.com.* /app/ctr(?P<any>.*)',
r'\g<any>'),
(r'/app(?P<any>.*)', r'\g<any>'))
----------------------------------------------------------------------------------------------
I created an
ASP.NET 4.0 web application on IIS 7 whose Virtual
Directory name is 'LTE1'
In it, I used the Visual Studio 2010 wizard to create a basic web
application (hello world roughly).
In that web application I had to modify the web.config as per the
documentation for ManagedFusion.Rewriter
I also created a 'bin' folder in LTE1 and copied the Managed Fusion
dll into into it.
The actual content of the .aspx pages in this .NET web app are
irrelevant as this app is never
rendered. Only its web.config is read and acted upon by Managed
Fusion, to cause the request to be passed to
the URL where web2py is running on Rocket at port 8000.
---------------------------------------------------------------------------------------------
Now if I browse to
http://138.85.50.99/LTE1
It hits IIS 7 and magically reroutes to my UETR web2py app at
http://138.85.50.99:8000/UETR?r=/LTE1
More work is needed to refine it, but the basic functionality is
shown.