posts in the category: PHP-GTK

Posted by: bob on Thursday March 31st 2011 5 comments
Tags: cairo, compile, php-gtk, ubuntu

This is an update to a document I wrote 4 years ago about compiling PHP-GTK on any Unixesque system you could get your hands on, but this one only for Ubuntu 10+. At the time of writing I was using a freshly installed Ubuntu 10.10 system to do this, so for the sake of completeness we are going to assume the system has nothing we need as though it was fresh off the installation disk a few minutes ago.

Here is an overview of what we have to do. The order is very important. If you do not follow the proper order things will not work right. This becomes very important when it comes time to build PHP-GTK itself.

  • Install subversion.
  • Install PHP5.
  • Install GTK development packages.
  • Install the Cairo module for PHP.
  • Get, patch, and compile PHP-GTK.

And here is how we do it. You are going to need a terminal window.

Continue reading about compiling PHP-GTK on Ubuntu

Posted by: bob on Thursday March 17th 2011 no comments
Tags: events, gtkprogressbar

Understanding the how to deal with pending events is an important part of programming with GTK. While not technically accurate (in any regards), it is useful to think of a PHP-GTK application as two threads or processes working together for one program. In one hand you have PHP running the program, on the other you have the GTK library running an idle loop to process its UI. If you hard lock PHP into a processing (for, while, foreach) loop GTK will be unable to process its updates until PHP finishes, and visa versa.

Here is an example where you might run into this issue. Lets say you have a directory full of files you need to read, and a window displaying a progress bar. These are two symptoms you might encounter:

  1. the appearance that your program has hardlocked and must be killed, and then at the last minute your progress bar jumps to 100%.
  2. your progress bar updates sporadically jumping large amounts instead of smoothly across.

… and both of these, generally, can be solved very easily. Most of the time just telling GTK to process events is enough to do it. And how do we do that?

Continue reading about GTK Pending Events…

Posted by: bob on Wednesday March 5th 2008 no comments
Tags: apache, config, gtk, help, php, php-gtk, web

PHP-GTK. Anyone who uses Linux often enough probably recognizes the two acronyms there. It sounds like a gift from the deity of choice to anyone who uses the PHP language frequently. PHP (Hypertext Preprocessor) as it stands to most people is one of the most common programming languages used today… on the web. Most are familiar with the need to have a web server with PHP so applications like forums and blogs can be run. The funny thing is that 99% of the people using PHP have no idea it really has nothing to do with Apache (the most common web server application), or that PHP does not even need a web server to run.

That number might be high, I just made it up, it could be closer to 98.9%. In any case this is the most frequently encountered problem we run into when trying to help people get started with PHP-GTK.

Let me get it out right now, PHP does not need a web server to be used. PHP does not need Apache. PHP does not need anything but itself. Thanks to the thing called the Command Line Interface (CLI, or PHP-CLI) you can write a PHP script to do things on your own computer just like a Bash script or Windows Batch file. Check out this from my Linux terminal window:

Continue Reading…