PHP-GTK2 Newsletter
|
Sample Code 28: How to distribute your PHP - GTK applications - Method 1? |
| Written by kksou | ||||||
| Thursday, 21 September 2006 | ||||||
|
Problem Suppose you have developed a GTK-PHP2 applications, and you would like to deploy this over 100+ sites within your company (or maybe school campus). The codes are updated very frequently. And each update requires you to propagate the changes throughout the 100+ sites. What are your options? Solution There are many different options for deployment of php-gtk applications. Here we present one method. Please take a look first at the sample code below - yes, 3 lines only! Run the code, and you should get the output as shown below. I'll elaborate more in the Explanation section. Sample Code
Explanation As you might have guessed, this method puts the bulk of the codes at the server side, in this case:
<?php
function hello_world() {
$window = new GtkWindow();
$window->set_size_request(400, 100);
$window->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse('#CCFF99'));
$window->connect_simple('destroy', array('Gtk','main_quit'));
$label = new GtkLabel('hello world from remote server!');
$window->add($label);
$window->show_all();
Gtk::main();
}
?>
The sample code simply includes the function above and calls the function As documented in the PHP manual, "if 'URL fopen wrappers' are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL instead of a local pathname." And this is exactly what we using here. By storing the main codes on your server, you only need to maintain one single copy of your code. There is no need to update any of the 100+ sites because they will always get the most updated copy direct from your server with the Of course, this method is based on the following assumptions:
Note
DO NOT use this method if security is your key concern.
The key advantage of this method is ease of maintenance and updating of your php-gtk application over large number of sites. User reviews Average user ratings: 4.5 (from 6 users) Note: You have to be a registered member to leave a comment. Free registration here. |
||||||
| < Prev | Next > |
|---|





4.5 (from 6 users)
February 28, 2008 5:31am
I could not access the file in question
I tried to make an example with a full-gtk php placed on the server
Oservidor interpleta the file and the error disendo that there is a class windows
See the error below
This is the file that I have on my desktop
It is placed on the file server
And this is the result
Fatal error : Class' GtkWindow 'not found in / var/www/php-gtk2/remote/mudacorfundo.php on line 2
February 28, 2008 6:31am
Hi Helder,
Sorry the article above was a bit "messed up" when I transfered it over from the previous version. Have just fixed it.
Take a look at the article again. You can place the bulk of your codes in your server. But the program itself must be run from your local machine, where PHP-GTK2 is installed.
Based on the error message, it seems that you're trying to run your code on the remote server, which does not have the php-gtk2 installed.
If you still can't get it to work, could you please post your code in the forum. They did not appear above.
Regards,
/kksou
August 21, 2008 10:14am
June 05, 2009 6:51am
August 17, 2009 12:15am
October 15, 2009 6:44am
Sangat menambah kemampuanku dalam hal security...