【问题标题】:load php extension in windows在windows中加载php扩展
【发布时间】:2012-09-23 11:09:28
【问题描述】:

我在 Windows 7 的 php 中加载我的扩展时遇到问题。 我已经在我的 Windows 上安装了 php 和 IIS,当我检查 phpinfo() 页面时,我发现我的 extension_dir 是 c:/php/ext。所以我将我的 dll 文件复制到该目录中,并将extension=php_mylib.dll 添加到 php.ini 文件中,然后我重新启动 IIS 并检查我的扩展是否已加载:

<?PHP
if (dl('php_mylib.dll')){ print ("YES")}
else{ print ("NO")}
?>

但每次运行此代码时,我都会得到“否”。感谢您的帮助。

【问题讨论】:

    标签: windows dll php-extension


    【解决方案1】:

    今天在稍微不同的系统上遇到了类似的问题 - Win 2008 R2 / IIS 7.5 / PHP 5.3.9 nts

    我希望启用 php_printer.dll 以进行网络打印。还没有找到不涉及编译 dll 的解决方案,但我确实了解到有人启用了安全模式。

    此信息来自手册@function.dl.php

    7 年前发布的信息帮助了我,似乎适合我的系统。

    以下是我发现有用的部分,来自前面点 ru 的 mag_2000:

    //make sure that we are ABLE to load libraries
    if( !(bool)ini_get( "enable_dl" ) || (bool)ini_get( "safe_mode" ) ) {
      die( "dh_local(): Loading extensions is not permitted.\n" );
    }
    
    //check to make sure the file exists
    if( !file_exists( $extensionFile ) ) {
     die( "dl_local(): File '$extensionFile' does not exist.\n" );
    }
    
    //check the file permissions
    if( !is_executable( $extensionFile ) ) {
      die( "dl_local(): File '$extensionFile' is not executable.\n" );
    }
    

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 2014-04-10
      • 2021-09-30
      • 2016-03-14
      • 1970-01-01
      • 2017-11-11
      • 2011-03-02
      • 1970-01-01
      • 2015-08-27
      相关资源
      最近更新 更多