Browse DevX
Sign up for e-mail newsletters from DevX


Develop Desktop GUI Apps with PHP-GTK, the Standalone PHP : Page 2

PHP enters the standalone GUI application arena with PHP-GTK. Learn the basic building blocks of PHP-GTK coding with a tutorial for first installing the language and then building and connecting its widgets, buttons, and functions.

Deploy PHP-GTK on Windows
First, you have to get a hold of the PHP-GTK installer. Create a folder on your C:\ drive called php_gtk, and download the file "php-gtk-1.0.0 Windows and PHP Binary including ComboButton, Extra, libGlade, Scintilla, Spaned, SQPane - 23-Oct-2003" to it.

Figure 2. Choose Which Program Opens .php Files: Choosing which program opens .php files.
Figure 3. Open .php Files with PHP_Win.exe: Open .php files with php_win.exe.

Double click the downloaded file to start your file decompression program (e.g., Winzip or Freezip), and extract its files into the C:\php_gtk folder.

Navigate to the extracted files in your C:\php_gtk folder. Cut and paste the folder "test" into the folder "php4". If this is a virgin PHP install for you, cut and paste the folder "php4" to your C:\ drive to create C:\php4. If you have PHP installed on your Windows server, keep your php.ini file inside the php4 folder to avoid conflicts (alternatively, you can upgrade your existing php.ini file with the new php-gtk.ini file).

Figure 4. Always_Use_Win_php_exe: Always use win_php.exe to open .php files.

If you run Windows 95/98/XP, copy the php.ini file (found in C:\php_gtk\winnt) to the C:\windows directory. If you run Windows 2000 or Windows NT, copy this php.ini file to your existing C:\winnt folder.

Finally, you have to get the PHP files to associate with php_win.exe. Navigate to C:\php4\test\hello.php and right click on it. Select Open With -> Choose Program (see Figure 2)—>Other (see Figure 3), and then associate php_win.exe with your .php files by browsing to C:\php4\php_win.exe, selecting Open, and checking the Always use this program to open these files box (see Figure 4).

Now, .php extensions will automatically run when they are double clicked, and the desktop icons of existing .php files have changed to the PHP-GTK icon. Navigate to the folder C:\php4\test and double click on hello.php. Try them all to see some of the possibilities of PHP-GTK.

One problem Dreamweaver users may face is that Dreamweaver will associate itself with their .php files. To solve this dilemma, open Windows Explorer—>Tools—>Folder Options. For Windows 98 users, this will be Windows Explorer—>View—>Folder Options (see Figure 5).

Figure 5. Explorer_Tools_Folderoptions1: A screenshot of Windows Explorer Folder Options.
Figure 6. Scroll_Folderoptions_Advanced2: Scroll folder options to remove Dreamweaver file associations.

Choose File Types and scroll until you find php and php3 (see Figure 6).

Click on the Advanced tab and remove any associations. Then click Okay. Navigate to the C:\php4\test folder and check out the sample applications included.

Thanks for your registration, follow us on our social networks to keep up-to-date