PHP/GTK How to install

Source: Internet
Author: User
Tags gtk
Installation of PHP/GTK

php-gtk-2.0.1 Source
php-gtk-2.0.1 Windows Binary Pack
php-gtk-2.0.1 Windows Binary Extensions Pack
is not all useful, installed in what place, hope pointing ...


Reply to discussion (solution)

Copy
PHP/GTK allows PHP to also write desktop applications
January 04, 2011? Php? No Comments

Previously PHP was supposed to be used only to write server-side CGI programs, if PHP can develop a GUI (graphical user interface) program under Windows, do you believe it? Recently, the PHP development team successfully developed a bundle of GTK + PHP, then you can develop a GUI program under Windows.

First, the establishment of PHP/GTK operating environment:
In fact, GUI program and ordinary phpcgi program no difference, but PHP/GTK program by GTK class to generate GUI interface, they are also open source code, rely on PHP to parse the build window. If you have set up a debugging environment for PHP, it is easier to install the PHP/GTK environment:
1. Download Php_gtk.dll (This DLL file is used to parse the GTK code inside the PHP source program) and unzip it to the PHP extension (extension) directory after downloading;
2, download the other PHP/GTK DLL files (altogether 6), unzip them into the Windows System32 directory;
3, open php.ini, in the Extended Settings section "Windows Extensions" the bottom of the "Extension=php_gtk.dll" statement, it is recommended to back up the php.ini, to avoid the failure of the modification of the establishment of a good PHP running environment obsolete;
Now we have established the PHP/GTK environment. Of course, you can also add "DL (' Php_gtk.dll ')" to the first line of each PHP/GTK program source code instead of the second step to dynamically load GTK support.
If you have not yet built a PHP runtime environment, it is easier to install:
1, download the entire PHP/GTK bundle support package, and then unzip them to the C-drive under the PHP4 directory;
2. Copy the DLL files from the Winnt directory to the Windows System32 directory and copy the php.ini files to the Windows directory;
After the PHP/GTK is established, you can run a PHP/GTK program with command-line php: Enter "C:php4php-q Gtkprogrampath" in the Run, where "c:php4php" is changed to PHP.EXE path, " Gtkprogrampath "is the path to the PHP/GTK program. For example, "C:php4php-q c:php4sampleshello.php" will run the example "Hello World" program that accompanies the PHP/GTK run package.

Second, compile the PHP/GTK program:
If you make a PHP/GTK application, you need the other person's computer to build PHP environment and use the PHP command line mode to parse to be able to execute, it is too complex. So how is it possible to compile a PHP/GTK program? After a search, the author found phpcompiler this software.
Phpcompiler is developed by www.deskcode.com (Http://www.deskcode.com/phpcompiler), PHP can be compiled into EXE executable file, built-in PHP support, if you want to compile a php/ GTK program, you must establish the operating environment of the PHP/GTK (refer to the previous steps). The steps to compile a PHP/GTK program are as follows:
1, open Phpcompiler (), in the "Script to" Select the PHP program you want to compile the source code, "Destination" in the successful compilation of the EXE file after the path;
2, click "Compile" button, will pop up a dialog box to ask for the compilation mode (if the PHP/GTK program to choose No, is simply the PHPCGI program to choose Yes);
3. A dialog box will then pop up asking if you want to copy the Php4ts.dll file to the compiled EXE directory and select Yes.
After the above steps, a PHP/GTK program compiles successfully, but there are a few points to note about compiling the PHP/GTK program:
1, after the completion of the implementation of the executable file, if necessary, the PC must have a GTK runtime environment required several DLL files (that is, the previous download), if necessary to make the application, Several DLL files can be copied to the System32 directory at the time of installation (but this is not a "green software" ^_^).
2, Phpcompiler itself for the support of PHP very good, but some people have tried to extend the support of some functions, such as "Gzopen" and so on, before the compilation is good, after the compilation is not ready to use. In fact, after the completion of the executable file, the equivalent of only the default PHP support (even the GTK support is not), so if you apply any function in the program that need to extend support, you must dynamically load the supporting function DLL file, such as "DL (' Php_gtk.dll ')", This will not be an error until the compilation is complete.
3, run a compiled executable file, will pop up a DOS window, and then automatically close, because each GUI window is "drawn" through GTK, so there must be a window.
4, perhaps before PHP can not be said to be true oop (object-oriented program) language, but to php/gtk, any window by the GTK object to "draw", if there is no strong OOP skills, it is difficult to write GUI program.

Third, PHP/GTK resources:
1, the official website of Http://gtk.php.net:PHP/GTK, although said to be the official website, but is very humble, out of a FAQ and mailing list, almost no useful things,
2, http://www.phpgtk.com: A better interface of the PHP/GTK site, with the latest version information.
3, Http://developer.gnome.org/doc/API/gtk/gtkobjects.html:PHP/GTK function and class of the Encyclopedia/Handbook website, which has a very rich php/gtk information.
4, http://www.phpuk.org/gtk/: Unofficial version of the GTK Handbook website, easy to understand.

If you think E is ugly, you can also come to zphp.com download the latest PHP/GTK Runtime environment and support package

2, download the other PHP/GTK DLL files (altogether 6), unzip them into the Windows System32 directory;

I'm not sure where these six files came from, I don't know what six files it is.

I remember as if there was a GTK package in the download, like Libgdk-win32-2.0-0.dll ..., but I didn't know it, because I didn't pretend to be successful ...
See if anyone else has any good advice ...

Ok thanks

Under Windows Two, under Linux 1th.

First, the establishment of PHP/GTK operating environment:
In fact, GUI program and ordinary phpcgi program no difference, but PHP/GTK program by GTK class to generate GUI interface, they are also open source code, rely on PHP to parse the build window. If you have set up a debugging environment for PHP, it is easier to install the PHP/GTK environment:
1. Download Php_gtk.dll (This DLL file is used to parse the GTK code inside the PHP source program) and unzip it to the PHP extension (extension) directory after downloading;
2, download the other PHP/GTK DLL files (altogether 6), unzip them into the Windows System32 directory;
3, open php.ini, in the Extended Settings section "Windows Extensions" the bottom of the "Extension=php_gtk.dll" statement, it is recommended to back up the php.ini, to avoid the failure of the modification of the establishment of a good PHP running environment obsolete;
Now we have established the PHP/GTK environment. Of course, you can also add "DL (' Php_gtk.dll ')" to the first line of each PHP/GTK program source code instead of the second step to dynamically load GTK support.
Hello, how exactly is the installation of PHP-GTK. I ran a lot of information.
But it's still not clear. I have already had PHP runtime environment, is installs the Wamp integration package. How am I going to add the PHP-GTK in?
I installed it according to your instructions, but I still do not know whether the installation is successful or not, and I do not know how to create a helloword to test
The PHP-GTK i downloaded contains:

I installed it according to the 1th and 3 steps you said. 2nd step because do not know which 6 files so did not do
My PHP installation directory is: C:\wamp\bin\php\php5.2.6
I found the Php_gtk2.dll file in my downloaded php-gtk2, put it in the PHP installation directory Ext folder, this folder is PHP extension
After doing this, I restarted all the services in Wamp, opened php php extensions in Wamp, and saw more php_gtk2 in the extension:

Tick Php_gtk2,wamp will automatically restart, and then open php.ini, you can see extension=php_gtk.dll this sentence has been added to the
But I don't know how to test it.
How do I create a Helloword project?

Later I copied the Demos folder in my downloaded php_gtk2 to the PHP installation directory
Then at the command line, enter PHP demos/phpgtk2-demo.php results for the load the PHP-GTK2 module in your php.ini
Phpgtk2-demo.php is a demo in the Demos folder


Part of the code in phpgtk2-demo.php:

The result of my command line output is the function of this code: Die (' Please load the PHP-GTK2 module in your php.ini '. "\ r \ n");


Part of the code in phpgtk2-demo.php:

The result of my command line output is the function of this code: Die (' Please load the PHP-GTK2 module in your php.ini '. "\ r \ n");

Supplement 6 Floor:
When I put this code in the phpgtk2-demo.php Comment: Die (' Please load the PHP-GTK2 module in your php.ini '. "\ r \ n");
Then the command line input PHP demos/phpgtk2-demo.php output is: The class "Gtkwindow" Can not be found:
(phpgtk2-demo.php 9th line of code error)

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.