Download the latest binaries from gtk.php.net.
The zip file contains all binaries needed to run core PHP-GTK, as well as extra features such as Glade/XML and Scintilla.
Extract the files to a temporary directory and then copy them into the following locations:
For Windows 98/NT/2000/XP:
In your PHP directory (e.g., c:\php4):
- php.exe
- php_win.exe
- php-cgi.exe
- php.ini
- php.ini-gtk
- all .dll files
In a test directory (e.g., c:\php4\test):
- all .php files
- testgtkrc
- testgtkrc2
- window.xpm
NOTE: You can install the php.ini into your Windows directory (i.e., c:\winnt
or c:\windows) as indicated by the zip file, but it is often not a good option,
depending on the installation. It is also no longer required; the php.exe (CLI
version as of PHP 4.3.0) will search the working directory, e.g., c:\php4, as
well as the Windows directory. Or you can specify your php.ini location in your
command line statement with '-c' option, as given in the php_win example below.
For Windows 95:
PHP-GTK has not been tested on Windows 95 ... sorry.
Testing the installation
When the PHP-GTK files are installed, you can verify your setup using a DOS
command line. A typical example would be: c:\php4\php c:\php4\test\hello.php
To avoid the DOS box, you can use the php_win executable, provided in the install file:
c:\php4\php_win c:\php4\test\hello.php
or
start c:\php4\php_win c:\php4\test\hello.php
or
c:\php4\php_win -c \php4\php.ini -f c:\php4\test\hello.php
If you have installed your php.ini file in your Windows directory, the -c option
can be dropped. For more information on command line options, see
'Using PHP from
the command line' on the main PHP site.
Troubleshooting
If you can't produce the hello window, try the following:
- Verify the hello.php location, i.e., [drive:]\php4\test
- Open hello.php in Notepad, and make sure there is no obvious corruption in the code.
- Modify your php.ini file, to log any errors, as detailed below.
- Review the postings at the PHP-GTK discussion list archive
for possible solutions.
- If you still have a problem, subscribe to the PHP-GTK general discussion
list and post your question there.
Tips/Tricks:
- To debug your scripts, modify the php.ini file as follows:
- Find the line for 'log_errors'. Set it to 'On'.
- Find the line for 'error_log'. Remove the beginning semicolon (uncomment)
and replace 'filename' with an actual file location
Example: error_log=c:\php4\error_log.txt.
- If the error file does not exist, php will create it on the next run. Open
the file and review.
- If you are planning to launch on an association, decide which extension you
want to use for your scripts. Be aware that other applications register .php, so
something like .php-gtk might be a better option.
- You can set your scripts to use Win32 themes, courtesy of Christian Weiske.
Check out the info page at:
http://www.cweiske.de/phpgtk_themes.htm
- Install the php-gtk launcher.
It handles many of the Windows directory issues and provides a series of PHP-GTK
icons. Also from Christian.
- Consider using Glade/XML for setting up your screens and reducing maintenance time.
Start with the info page at: http://gtk.php.net/manual1/en/glade.gladexml.php.
// Create the dialog window:
$fs = &new GtkFileSelection("Save file");
// Get a handle to the Ok button:
$ok_button = $fs->ok_button;
// Connect a function:
$ok_button->connect("clicked", "enddialog");
// Connect the destroy action on the dialog window:
$ok_button->connect_object("clicked", "destroy", $fs);
It is not currently possible to do it this way:
// Create the dialog window
$fs = &new GtkFileSelection("Save file");
// Connect a function
$fs->ok_button->connect("clicked", "enddialog");
// Connect the destroy action on the dialog window
$fs->ok_button->connect_object("clicked", "destroy", $fs);