{"id":1447,"date":"2018-01-19T19:22:51","date_gmt":"2018-01-19T19:22:51","guid":{"rendered":"http:\/\/goofy-trucks.flywheelsites.com\/installing-php-gtk-on-linux-page-3\/"},"modified":"2018-01-19T19:24:47","modified_gmt":"2018-01-19T19:24:47","slug":"installing-php-gtk-on-linux-page-3","status":"publish","type":"post","link":"https:\/\/phpbuilder.com\/installing-php-gtk-on-linux-page-3\/","title":{"rendered":"Installing PHP-GTK on Linux Page 3"},"content":{"rendered":"<div class=\"phpbuilder-content\">\n<div class=\"phpbuilder-meta\">\n<div class=\"\">By John Starkey<\/div>\n<div class=\"\">on April 1, 2003<\/div>\n<\/p><\/div>\n<div id=\"overflow-content\">\n<div class=\"articleHeader\">\nChecking your work<\/div>\n<div class=\"articlePara\">\nSince this is intended as a precursor to a series of PHP-Gtk articles, I&#8217;ll simply provide a quick cut and<br \/>\npaste script, to make sure everything is as nature intended.<\/div>\n<div class=\"articlePara\">\nCopy the following code into a file, in your home directory, named simple.php:<\/div>\n<div class=\"articlePhpEx\">\n<font face=\"courier\"><code><span style=\"color: #000000\"><\/p>\n<p>#!\/usr\/local\/bin\/php\u00a0-q\u00a0<\/p>\n<p><span style=\"color: #0000BB\">&lt;?php<\/p>\n<p><\/span><span style=\"color: #007700\">function\u00a0<\/span><span style=\"color: #0000BB\">quitApplication<\/span><span style=\"color: #007700\">()<br \/>\n<br \/>{<br \/>\n<br \/>\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"color: #0000BB\">Gtk<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">main_quit<\/span><span style=\"color: #007700\">();<br \/>\n<br \/>}<\/p>\n<p><\/span><span style=\"color: #0000BB\">dl<\/span><span style=\"color: #007700\">(\u00a0<\/span><span style=\"color: #DD0000\">'php_gtk.so'\u00a0<\/span><span style=\"color: #007700\">)\u00a0||\u00a0die(\u00a0<\/span><span style=\"color: #DD0000\">'Unable\u00a0to\u00a0load\u00a0php_gtk\u00a0module!\u00a0YOU\u00a0BROKE\u00a0ME!n'\u00a0<\/span><span style=\"color: #007700\">);<\/p>\n<p><\/span><span style=\"color: #0000BB\">$window\u00a0<\/span><span style=\"color: #007700\">=\u00a0&amp;new\u00a0<\/span><span style=\"color: #0000BB\">GtkWindow<\/span><span style=\"color: #007700\">;<br \/>\n<br \/><\/span><span style=\"color: #0000BB\">$window<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">set_title<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"PHP\u00a0does\u00a0GTK\"<\/span><span style=\"color: #007700\">);<br \/>\n<br \/><\/span><span style=\"color: #0000BB\">$window<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">set_default_size<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">gdk<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">screen_width<\/span><span style=\"color: #007700\">()*<\/span><span style=\"color: #0000BB\">.85<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">gdk<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">screen_height<\/span><span style=\"color: #007700\">()*<\/span><span style=\"color: #0000BB\">.85<\/span><span style=\"color: #007700\">);<\/p>\n<p><\/span><span style=\"color: #0000BB\">$window<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">connect<\/span><span style=\"color: #007700\">(\u00a0<\/span><span style=\"color: #DD0000\">'delete_event'<\/span><span style=\"color: #007700\">,\u00a0<\/span><span style=\"color: #DD0000\">'quitApplication'\u00a0<\/span><span style=\"color: #007700\">);<br \/>\n<br \/><\/span><span style=\"color: #0000BB\">$window<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">show_all<\/span><span style=\"color: #007700\">();<\/p>\n<p><\/span><span style=\"color: #0000BB\">Gtk<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">main<\/span><span style=\"color: #007700\">();<\/p>\n<p><\/span><span style=\"color: #0000BB\">?&gt;<br \/>\n<br \/><\/span><br \/>\n<\/span><br \/>\n<\/code><\/font><\/div>\n<div class=\"articlePara\">\nYou may need to change the path to your PHP binary in the first line. This can be found by typing<br \/>\n&#8216;which php&#8217; at the command prompt. Once that&#8217;s done, at the prompt type:<\/div>\n<div class=\"example\">\n~\/simple.php\n<\/div>\n<div class=\"articlePara\">\nThis should open a blank window. If so, you&#8217;re ready to move on. If not, back up and try again. As always,<br \/>\nif you run into a snag, you can find some help in our <a href=\"..\/board\/index.html\" target=\"_blank\">community<br \/>\nforums<\/a>.<\/div>\n<div class=\"articlePara\">\nIn the next article we&#8217;ll deal with creating a more likable interface using Glade. Until then&#8230;<\/div>\n<div class=\"articlePara\">&#8212;<\/div>\n<div class=\"articlePara\">\nI&#8217;d like to thank Steph Fox from the PHP-Gtk team for her help with clarifying some of the info contained<br \/>\nin this article and the ones to follow. Everyone say &#8220;HI STEPH!!&#8221; \ud83d\ude42<\/div>\n<\/div>\n<p><\/p>\n<div style=\"float: left; padding:15px; color:#17AAF3\">\n<div style=\"float:left; padding:2px;\"><a class=\"paginationPageLink\" href=\"starkey200304014658.html?page=2\">\u00ab Previous Page<\/a><\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"starkey20030401.html\">1<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"starkey200304014658.html?page=2\">2<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"background-color:#B6E5FC; font-size:16px; margin-top:1px; padding:1px 4px 1px 4px; color:#000; font-style:bold; float:left;\">3<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>One of the better inventions of the 21st Century is with no doubt PHP-Gtk. Created in March 2001, in an effort to show that PHP isn&#8217;t just a web<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1447","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/comments?post=1447"}],"version-history":[{"count":1,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1447\/revisions"}],"predecessor-version":[{"id":3305,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1447\/revisions\/3305"}],"wp:attachment":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/media?parent=1447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/categories?post=1447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/tags?post=1447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}