代码之家  ›  专栏  ›  技术社区  ›  Mark Lalor

php.ini中的php gtk模块

  •  1
  • Mark Lalor  · 技术社区  · 15 年前

    我安装 PHP GTK 在里面 C:\php-gtk 但当我去 从命令中运行它 像这样的线

    cd C:\php-gtk2
    php demos\phpgtk2-demo.php
    

    它给出了这个错误

    Please load the php-gtk2 module in your php.ini
    

    我的 INI文件 包含此内容(它被称为 php-cli.ini )

    [PHP]
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; About the php.ini in PHP-GTK ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;
    ; This file introduces the php.ini settings that you will need in order to
    ; run PHP-GTK on your system. You may also need other settings from PHP's
    ; standard php.ini file, e.g. to load further extensions or otherwise control
    ; PHP's behaviour in matters such as error reporting. Please add those in
    ; the upper part of this file, in the PHP section.
    
    ; You should use PHP's CLI executable to run PHP-GTK. This php.ini file
    ; should be in the same directory as the PHP executable, to avoid conflict
    ; with any other copies of PHP that may be installed on your machine.
    
    ; The first thing you will need to do is tell PHP where you want it to look
    ; for the PHP extension libraries (php_*.dll or php_*.so files) on your system.
    
    extension_dir = "./ext"
    
    ; Make sure that php-gtk2.dll under Windows, or php-gtk2.so under Unix, is in
    ; the directory named in extension_dir alongside any other shared PHP extensions
    ; you intend to use, and tell PHP to load it.
    
    extension = php_gtk2.dll
    ;extension = php_pdo.**
    ;extension = php_sqlite.**
    ;extension = php_pdo_sqlite.**
    
    [Date]
    ; Defines the default timezone used by the date functions
    ;date.timezone = 
    
    [PHP-GTK]
    
    ;;;;;;;;;;;;;;;;;;;;;;
    ; PHP-GTK extensions ;
    ;;;;;;;;;;;;;;;;;;;;;;
    
    ; Extensions written for PHP-GTK are in the format php_gtk_*.dll (Windows) or
    ; php_gtk_*.so (Unix), written here as a comma-separated list. The library
    ; files need to be in the same directory as the PHP-GTK library, along with
    ; any other PHP extensions you are using.
    
    ;php-gtk.extensions = php_gtk_libglade2.dll,php_gtk_sourceview2.dll
    
    ;;;;;;;;;;;;;
    ; Code Page ;
    ;;;;;;;;;;;;;
    
    ; The string variables used for titles and other text values in GTK+ are
    ; encoded in UTF-8 internally. A code page is needed so that PHP-GTK 'knows'
    ; which character set is being used, and can convert it to UTF-8 as necessary.
    
    ; If your environment uses UTF-8 already, you can set the codepage directive
    ; to UTF-8 to skip the conversions.
    
    ; The default codepage setting in PHP-GTK 2 is ISO-8859-1, but you can also
    ; use either OEM (e.g. 850) or Windows Code Pages (e.g. CP1250) here, so
    ; long as the encoding format you choose is capable of iconv conversion. See
    ; http://www.microsoft.com/globaldev/reference/cphome.mspx for a list of
    ; the code pages and character sets that are supported on Windows systems.
    
    php-gtk.codepage = CP1250
    

    我需要做什么? Ini有问题 文件?我需要 重命名 是吗?有什么问题吗 启动程序?

    3 回复  |  直到 11 年前
        1
  •  2
  •   Melsi    14 年前

    您可以更进一步,不用担心路径,我在Windows环境中工作,甚至在.in i内部也使用相对路径,如下所示:

    extension_dir = "ext"
    extension = php_cairo.dll
    extension = php_mongo.dll
    

    这允许我将php gtk文件夹移到任何地方。

    至于运行我的项目,我做了类似的事情,我创建了.cmd文件,如下所示:

    "%CD%\..\..\PhpGtkRuntime\php.exe"  "%CD%\index.php"
    

    例如,您可以有一个中心文件夹,子文件夹中有php gtk,而在另一个文件夹中,您所有的项目都是这样的:

    php-gtk/PhpGtkRuntime 
    php-gtk/Projects
    

    整个想法是我将一个文件夹分发给最终用户,其中包含一个run.cmd,然后用户对该文件夹进行简单的复制粘贴,实际上没有其他内容。我做了一个包含mongodb的示例包,所有包都是可移植的,甚至mongodb也是如此。 Check here..

        2
  •  1
  •   Mark Lalor    15 年前

    好的 问题是我需要调用php gtk 像我一样 已将其重命名

        3
  •  1
  •   Jubayer Arefin    11 年前

    刚刚解决了问题。

    我试图从demos文件夹运行演示脚本。但是当我用php.exe所在的同一个文件夹进行尝试时,它运行得很顺利。因此,php-cli.ini没有问题,也无需担心此错误“请在php cli.ini中加载php-gtk2模块”。

    所以祝PHP-GTK好运。

    推荐文章