Back to ROFLOL

PHP-GTK

Fri14Jul2006

Subcontent
Compiling PHP-GTK on UNIXesque OS
Download PHP-GTK for UNIXesque OS

What The.
PHP-GTK is a PHP module that enables the use of GTK functions from inside PHP. This allows us to build user friendly graphical interfaces quickly and easily in PHP.

But PHP is a web server language!
Not really, that is probably where you are just used to seeing it. Thanks to the PHP-CLI PHP can be used to write normal local host applications that execute like any other program you would use. Since PHP runs on multiple platforms it is easy to develop applications that will run without many special cases for what operating system may be running at the time.

#IFDEF WIN32
Plop this module on top of the CLI and now we can create full blown programs you can 'point and click' on, and in most cases will run in Linux and Windows without any care in the world. That is a good thing. If you know me, then you know I do not have much patience for Windows programming.

Getting it installed and running in Linux is pretty simple. Assuming you have a working installation of PHP then you just compile the PHP-GTK source code and go. I have even built a Unix Installer to install a pre-compiled binary and configure PHP. To install in Windows is even easier, just unzip and go.

Getting GTK All Over It
If you're looking for some help in PHP-GTK programming then you might want to check out the list of related links below, there are plenty of resources to get you on your way. I also have documents and tutorials which include some code standard proposals.

Related Sites.
      PHP-GTK
      Bob's PHP-GTK2 Tutorials
      PHP-GTK Community Site

Over the past few weeks I have been slowly converting my massive directory of code samples into documents and examples for OOPS. Among others, that site now contains the following tutorials:

      • About Events Pending Loops (Force GUI Updates)
      • Timeout Basics (Running a function at intervals)
      • Password Entry Fields using GtkEntry
      • Link buttons and opening browsers
      • Auto scrolling text view ... Read More.

I am referring to this PHP bug where the proc_open() ability to use system PTY's was disabled because of a bad "configure check". It has been over a year already.

 

 

Why am I complaining though? Because PTY is the only way to enable the reading of STDOUT of child processes from background processes. This example code is in my radio.phpg file.

 

$pp = proc_open(
      "mplayer '{$url}'",
      array(
            array('pipe','r'),
            array('pipe','w'),
            array('pty','w')
      ),
      $pipe, null, null
);

 

 

// read stdout
Gtk::io_add_watch(
      $pipe[1],
      GObject::IO_IN,
      array($this,'on_player_output')
);

 

Any idea why `./radio.php` works and `./radio.phpg &` does not? Because forcing it into the background it never connected to a ... Read More.

 

Why Copy Paste?

Sun9Dec2007

I think a lot of people forget about some of the more useful features of their operating system when they start to write PHP-GTK programs: shared libraries.

In PHP, there is a config option called include_dir where you can tell PHP to look for files passed to include() and require() - and those functions when told to load files from a relative path and failing to find them in the local file tree... checks the include_dir.

On every system I have setup, this has defaulted to /usr/lib/php or /usr/local/lib/php which you might recognize as the folder which contains the folder which contains ... Read More.

 

PHP-GTK2 Unix Installer

Thu8Nov2007

One problem we still face is the lack of binary packages for PHP-GTK2 in Linux distributions. I was starting to build an Ubuntu 7.10 package last night and got about half way done and thought... "eh screw this I never even use Ubuntu". For this reason I have focused my efforts on writing a Universal installer that will work on any Linux distribution. Not only that, but FreeBSD and Solaris as well.

 

user posted image

 

Goals: It should Just Work, and as easily as possible.

I need help from people to test it. I only have so many computers and operating systems here. If you ... Read More.

 

Tutorials and Examples

Mon5Nov2007

I have put together a new site for my PHP-GTK tutorials and examples. The goal being clean and working standalone applications that use and teach all of what PHP5 Object Orientation has to offer. Since PHP-GTK is an OOP extension it makes sense to me to have OOP examples instead of procedural ones. Also on this site is a guide to compiling PHP-GTK on Unixesque operating systems.

Some Highlights:
      • Compile PHP-GTK2
      • Configure PHP for GTK
      • Hello World
      • Simple Application: Hello There, Your OS is... ... Read More.