• Delphi6+Apache Web 应用


    Delphi6目前只能和Apache 1.X兼容使用(有方法兼容2.2X但还未测试成功)。

    1)新建Web Server Application

    File--New--Others--Web Server Application,建立好Web项目。

    2)编辑dpr文件

    在exports语句前加入以下语句,将动态链接库的扩展名改为.so,并且输出的文件为'mod_'+项目名。

    {$E so}
    {$LIBPREFIX 'mod_'}

    修改exports语句:

    exports
      apache_module name 'test_module'
    

    其中test_module 可以任意取名,只要与Apache配置文件中保持一致即可。 

    3) 编辑TWebModule文件

    在WebModule可视化界面双击空白,出来Action Editor界面,添加一个Action,PathInfo可以为空,Default=True。

    在Event中添加onAction事件,添加测试代码:

    Response.Content := '<H1>Hello World</H1>'
    

    4)编译项目,生成.so动态链接库文件

    测试为mod_WebApp.so

    5)配置Apache Config文件,路径为Apacheconfhttpd.conf

    在末尾加入以下代码:

    LoadModule test_module "D:SourceCodeWebAppTestmod_WebApp.so"
    <Location /delphi>
      SetHandler mod_webapp-handler
    </Location>
    

    "test_module" 为 2)中填写的 exports apache_module name

    "D:SourceCodeWebAppTestmod_WebApp.so" 为生成的动态链接文件路径

    "/delphi" 为 URL后面跟的应用程序名称

    "mod_webapp-handler" 为 动态链接库名称不带后缀名(全部转为小写)+"-handler"  

    6)输入网址进行测试

    浏览器中输入 http://localhost/delphi  (delphi大小写敏感)

    如果成功的话则返回 Hello World,错误则会返回404 Error

  • 相关阅读:
    以定位为核心的互联网产品思维
    互联网服务有两种,1是靠软件卖产品,2是靠卖软件盈利
    以用户为核心的互联网思维
    xpath定位详解
    jmeter性能测试的经验总结
    IT男的”幸福”生活"续2
    MySql索引数据结构
    机器学习第四章学习记录和心得
    《机器学习》第一次作业——第一至三章学习记录和心得
    华为云使用初探
  • 原文地址:https://www.cnblogs.com/maopaidashu/p/5158676.html
Copyright © 2020-2023  润新知