faq.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?php
  2. require_once('include/prepend.php');
  3. commonHeader('Frequently Asked Questions');
  4. ?>
  5. <h1>Frequently Asked Questions</h1>
  6. <ul>
  7. <li><a href="#1">What is PHP-GTK?</a></li>
  8. <li><a href="#2">Why is it not working with the browser/web server?</a></li>
  9. <li><a href="#3">How do I install PHP-GTK on Win32?</a></li>
  10. <li><a href="#4">How do I use the buttons in GtkFileSelection?</a></li>
  11. <li><a href="#5">How do I know which GTK Classes are supported?</a></li>
  12. <li><a href="#6">Can I use Themes under Win32?</a></li>
  13. <li><a href="#7">Where do I go from here?</a></li>
  14. </ul>
  15. <dl>
  16. <dt>
  17. <a name="1"><b>What is PHP-GTK?</b></a>
  18. </dt>
  19. <dd>
  20. <p>
  21. PHP-GTK is a PHP extension that implements language bindings for GTK+. It
  22. provides an object-oriented interface to GTK+ classes and functions and greatly
  23. simplifies writing client side cross-platform GUI applications.
  24. </p>
  25. </dd>
  26. <dt>
  27. <a name="2"><b>Why is it not working with the browser/web server?</b></a>
  28. </dt>
  29. <dd>
  30. <p>
  31. PHP-GTK is not meant to be used in the Web environment. It is intended for
  32. creation of standalone applications (run via command-line, user's desktop, etc.).
  33. </p>
  34. </dd>
  35. <dt>
  36. <a name="3"><b>How do I install PHP-GTK on Win32?</b></a>
  37. </dt>
  38. <dd>
  39. <p>
  40. Download the latest binaries from <a href="http://gtk.php.net/download.php">gtk.php.net</a>.
  41. The zip file contains all binaries needed to run core PHP-GTK, as well as extra features such as Glade/XML and Scintilla.
  42. Extract the files to a temporary directory and then copy them into the following locations:
  43. </p>
  44. <p>
  45. <b>For Windows 98/NT/2000/XP:</b>
  46. </p>
  47. <p>In your PHP directory (e.g., c:\php4):</p>
  48. <ul>
  49. <li>php.exe</li>
  50. <li>php_win.exe</li>
  51. <li>php-cgi.exe</li>
  52. <li>php.ini</li>
  53. <li>php.ini-gtk</li>
  54. <li>all .dll files</li>
  55. </ul>
  56. <p>In a test directory (e.g., c:\php4\test):</p>
  57. <ul>
  58. <li>all .php files</li>
  59. <li>testgtkrc</li>
  60. <li>testgtkrc2</li>
  61. <li>window.xpm</li>
  62. </ul>
  63. <p>
  64. NOTE: You can install the php.ini into your Windows directory (i.e., c:\winnt
  65. or c:\windows) as indicated by the zip file, but it is often not a good option,
  66. depending on the installation. It is also no longer required; the php.exe (CLI
  67. version as of PHP 4.3.0) will search the working directory, e.g., c:\php4, as
  68. well as the Windows directory. Or you can specify your php.ini location in your
  69. command line statement with '-c' option, as given in the php_win example below.
  70. </p>
  71. <p>
  72. <b>For Windows 95:</b>
  73. </p>
  74. <p>
  75. PHP-GTK has <b>not</b> been tested on Windows 95 ... sorry.
  76. </p>
  77. <p>
  78. <b>Testing the installation</b>
  79. </p>
  80. <p>
  81. When the PHP-GTK files are installed, you can verify your setup using a DOS
  82. command line. A typical example would be: c:\php4\php c:\php4\test\hello.php
  83. </p>
  84. <p>
  85. To avoid the DOS box, you can use the php_win executable, provided in the install file:
  86. </p>
  87. <pre>
  88. c:\php4\php_win c:\php4\test\hello.php
  89. </pre>
  90. <p>
  91. or
  92. </p>
  93. <pre>
  94. start c:\php4\php_win c:\php4\test\hello.php
  95. </pre>
  96. <p>
  97. or
  98. </p>
  99. <pre>
  100. c:\php4\php_win -c \php4\php.ini -f c:\php4\test\hello.php
  101. </pre>
  102. <p>
  103. If you have installed your php.ini file in your Windows directory, the -c option
  104. can be dropped. For more information on command line options, see
  105. <a href="http://www.php.net/manual/en/features.commandline.php">'Using PHP from
  106. the command line'</a> on the main PHP site.
  107. </p>
  108. <p>
  109. <b>Troubleshooting</b>
  110. </p>
  111. <p>If you can't produce the hello window, try the following:</p>
  112. <ul>
  113. <li>Verify the hello.php location, i.e., [drive:]\php4\test</li>
  114. <li>Open hello.php in Notepad, and make sure there is no obvious corruption in the code.</li>
  115. <li>Modify your php.ini file, to log any errors, as detailed below.</li>
  116. <li>Review the postings at the <a href=
  117. "http://marc.theaimsgroup.com/?l=php-gtk-general">PHP-GTK discussion list archive</a>
  118. for possible solutions.</li>
  119. <li>If you still have a problem, subscribe to the <a
  120. href="mailto:php-gtk-general-subscribe@lists.php.net">PHP-GTK general discussion
  121. list</a> and post your question there.</li>
  122. </ul>
  123. <p>
  124. <b>Tips/Tricks:</b>
  125. </p>
  126. <ul>
  127. <li>To debug your scripts, modify the php.ini file as follows:
  128. <ul>
  129. <li>Find the line for 'log_errors'. Set it to 'On'.</li>
  130. <li>Find the line for 'error_log'. Remove the beginning semicolon (uncomment)
  131. and replace 'filename' with an actual file location<br/>
  132. Example: error_log=c:\php4\error_log.txt.</li>
  133. <li>If the error file does not exist, php will create it on the next run. Open
  134. the file and review.</li>
  135. </ul>
  136. </li>
  137. <li>If you are planning to launch on an association, decide which extension you
  138. want to use for your scripts. Be aware that other applications register .php, so
  139. something like .php-gtk might be a better option.</li>
  140. <!--
  141. <li>Check out the Code Snippets and Code Hints on the
  142. <a href="http://gtk.php.net/wiki/">PHP-GTK Wiki page</a>.</li>
  143. -->
  144. <li>You can set your scripts to use Win32 themes, courtesy of Christian Weiske.
  145. Check out the info page at:<br/>
  146. <a href="http://www.cweiske.de/phpgtk_themes.htm ">http://www.cweiske.de/phpgtk_themes.htm </a></li>
  147. <li>Install the <a href="http://www.cweiske.de/phpgtk_apps.htm#phpgtklauncher">php-gtk launcher</a>.
  148. It handles many of the Windows directory issues and provides a series of PHP-GTK
  149. icons. Also from Christian.</li>
  150. <li>Consider using Glade/XML for setting up your screens and reducing maintenance time.<br/>
  151. Start with the info page at: <a
  152. href="http://gtk.php.net/manual1/en/glade.gladexml.php">http://gtk.php.net/manual1/en/glade.gladexml.php</a>.
  153. </li>
  154. </ul>
  155. </dd>
  156. <dt>
  157. <a name="4"><b>How do I use the buttons in GtkFileSelection?</b></a>
  158. </dt>
  159. <dd>
  160. <pre class="code">
  161. // Create the dialog window:
  162. $fs = &amp;new GtkFileSelection("Save file");
  163. // Get a handle to the Ok button:
  164. $ok_button = $fs->ok_button;
  165. // Connect a function:
  166. $ok_button->connect("clicked", "enddialog");
  167. // Connect the destroy action on the dialog window:
  168. $ok_button->connect_object("clicked", "destroy", $fs);
  169. </pre>
  170. <p>
  171. It is <b>not</b> currently possible to do it this way:
  172. </p>
  173. <pre class="code">
  174. // Create the dialog window
  175. $fs = &amp;new GtkFileSelection("Save file");
  176. // Connect a function
  177. $fs->ok_button->connect("clicked", "enddialog");
  178. // Connect the destroy action on the dialog window
  179. $fs->ok_button->connect_object("clicked", "destroy", $fs);
  180. </pre>
  181. </dd>
  182. <dt>
  183. <a name="5"><b>How do I know which GTK Classes are supported?</b></a>
  184. </dt>
  185. <dd>
  186. <p>
  187. The following code will show the defined classes. All the PHP-GTK
  188. classes will be listed along with one or two others.
  189. </p>
  190. <pre class="code">
  191. $array = get_declared_classes();
  192. while(list(,$classname) = each($array)) {
  193. echo $classname."\n";
  194. }
  195. </pre>
  196. <p>
  197. See the <?php print_link('http://www.php.net/manual/en/ref.classobj.php', 'Class/Object functions'); ?>
  198. in the PHP Manual for other useful functions.
  199. </p></dd>
  200. <dt>
  201. <a name="6"><b>Can I use Themes under Win32?</b></a>
  202. </dt>
  203. <dd>
  204. <p>
  205. No, The Win32 GTK port does not currently support this.
  206. </p>
  207. </dd>
  208. <dt>
  209. <a name="7"><b>Where do I go from here?</b></a>
  210. </dt>
  211. <dd>
  212. <p>
  213. Check out the <?php print_link('/resources.php', 'Resources page'); ?>.
  214. </p>
  215. </dd>
  216. </dl>
  217. <?php
  218. commonFooter();
  219. ?>