Practical PHP/GTK (reposted)
Published by Diao Yan on 2002-2-19 15:25 PHP Programming ← Return to the layout
In the past, PHP was considered to be only used to write server-side CGI programs. If PHP can develop Windows GUI (Graphical User Interface) program, do you believe it? Recently, the PHP development team successfully developed PHP bundled with GTK+, so that GUI programs under Windows can be developed.
1. Establish a PHP/GTK operating environment:
In fact, there is no difference between GUI programs and ordinary PHPCGI programs. It is just that PHP/GTK programs generate GUI interfaces from GTK classes. They are also open source codes. Rely on PHP to parse and create windows. If you have already established a PHP debugging environment, it is relatively simple to install the PHP/GTK environment:
1. Download php_gtk.dll (this dll file is used to parse the GTK code in the PHP source program), and unzip it after downloading Go to the PHP extension directory;
2. Download other PHP/GTK dll files (6 in total), and unzip them into the system32 directory of Windows;
3. Open php.ini, Add the statement "extension=php_gtk.dll" at the bottom of the "Windows Extensions" section of the extension settings. It is recommended to back up php.ini first to avoid failure to modify and invalidate the established PHP running environment;
PHP is now established/ GTK's operating environment. Of course, you can skip the second step and add "dl('php_gtk.dll')" to the first line of each PHP/GTK program source code to dynamically load GTK support.
If you have not set up a PHP running environment, then the installation is simpler:
1. Download the entire PHP/GTK bundled support package, and then unzip them to the PHP4 directory of the c drive;
2 , Copy the dll file under the winnt directory to the system32 directory of Windows, and copy the php.ini file to the Windows directory;
After establishing the operation of PHP/GTK, you can use PHP in command line mode to run it A PHP/GTK program: Enter "c:php4php -q gtkprogrampath" during operation, where "c:php4php" is changed to the path of PHP.EXE, and "gtkprogrampath" is the path of the PHP/GTK program. For example: "c:php4php -q c:php4sampleshello.php" will run the sample "hello world" program included in the PHP/GTK runtime package.
2. Compile PHP/GTK program:
If you make a PHP/GTK application and need the other party’s computer to establish a PHP operating environment and use the PHP command line mode to parse it before it can be executed, then Too complicated. So how can you compile a PHP/GTK program? After some searching, the author discovered the software PHPCompiler.
PHPCompiler is developed by www.deskcode.com (http://www.deskcode.com/phpcompiler). It can compile PHP into an EXE executable file. It has built-in PHP support. If you want to compile a PHP/GTK program , the PHP/GTK operating environment must be established (refer to the previous steps). The steps to compile a PHP/GTK program are as follows: