大赵传奇

GIS解决方案,webgis , 桌面、数据、服务--QQ276605216

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
  270 随笔 :: 1 文章 :: 64 评论 :: 19万 阅读

1、安装配置问题

iis处理程序模块

 

php.ini:

date.timezone="Asia/Shanghai"

extension_dir="C:\php-7.4.33-nts-Win32-vc15-x64\ext"

extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_pdo_mysql.dll
extension=php_com_dotnet.dll

 

 

 

 

2、winserver 2012安装了php 之后,再安装 微软VC++运行库合集_2023.04.24.exe ,可以跑.net 4程序了,但iis 下php ,远程php 提示404.3 NOT FOUND错误

一、检查并修正 PHP FastCGI 处理程序

1. 确保 PHP FastCGI 处理程序已添加

打开 管理员 CMD,执行以下命令检查 PHP 是否正确映:

%windir%\system32\inetsrv\appcmd list config /section:system.webServer/handlers

如果 *.php 没有映射到 FastCgiModule,或者指向的路径不是 d:\php7433\php-cgi.exe,那么需要手动添加:

%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+"[name='PHP-FastCGI', path='*.php', verb='GET,HEAD,POST', modules='FastCgiModule', scriptProcessor='d:\php7433\php-cgi.exe', resourceType='File']"

然后 重启 IIS:

iisreset

web.config文件

复制代码
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
        </staticContent>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="index.asp" />
            </files>
        </defaultDocument>
        <httpErrors errorMode="Detailed" />
        <handlers>
            <remove name="PHP-FastCGI" />
            <add name="PHP-FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="d:\php7433\php-cgi.exe" resourceType="File" />
        </handlers>
    </system.webServer>
</configuration>
复制代码

2、解决浏览器中 php 404错误以后,开始测试 call dotnet  程序:

方案

test3.php

<?php 
  $stack = new DOTNET("mscorlib", "System.Collections.Stack"); 
  $stack->Push(".Net"); 
  $stack->Push("Hello "); 
  echo $stack->Pop() . $stack->Pop(); 
?>

http://192.168.9.139:8090/test3.php  可得正常结果。

test2.php

<?php
$sem="c:\\test1\\classLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e64c93b3fd88cb63";
$class = "CC1.AA"; // its the namespace and the class.
$dotnet = new DotNet($sem, $class);
echo $dotnet->MyMethod("World");
?>

这是一个c# 4.0的 dll ,输出x86, 还anycpu都不可以

conole.php:

<?php
$output = shell_exec('ConsoleApp1.exe World222');
echo $output;
?>

也不可以。

中间尝试将classLibrary1.dll 使用regasm 注册,也不可以。

 

 

posted on   赵长青  阅读(8)  评论(0)    收藏  举报
点击右上角即可分享
微信分享提示