Jump to content


Photo

Question RE GTK


  • Please log in to reply
3 replies to this topic

#1 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 20 September 2006 - 12:09 AM

MODS: Move if ya must, but GTK is PHP at the end of the day

Anyway
Guys, Girls,
I am starting on PHP GTK
and as it stands at the moment, as far as I know, there are no decent compilers to create the files into a .exe, (not for GTK2)
So the only way of running the application, is to have the GTK stuff installed on the users machine, (.NET requere .NET Framework, so still the same sorta ting)
AND
Sendin them the php files, which with a simple text editor, they can view the code

SO
I was thinking about storing the .php files on a Web Server, and the user installs the GTK stuff, and has the phpw file
Which they run, and uses the file from the website

OK
if your lost already, then dont bother reading on, cos I am just getting started

I uploaded the files to my WebServer
and I changed the phpw file to
include('http://www.example.com/gtk/main.php');
(Instead of the usual
include(dirname(__FILE__) .'/test.php');
)

I am running Crimson Editor, and it comes up with the php cmd promt, and briefly shows an error messages, then closes
I managed to screen grab this message, so I can read it (Took ages, but)

It was saying about a Parse Error on line 6
Line 6 Reads
function login(GtkWindow $wnd, GtkEntry $txtUsername, GtkEntry $txtPassword){
Which
Before you guys who dont know about GTK, jump
Yes, is an error in PHP Web
but
its normal in PHP GTK
I can run the same file from my machine no problems

So
If your still with me, you deserve a pat on the back

I was thinking
This error is cos the web server has not got php GTK set up

SO
Does this mean, if the web server has php gtk installed, then the user does not need to install PHP GTK

if true
Then how would the user run the phpw file

if False (which I tink)
Then how come when I run the file, its looking on the servers php settings, not my machine

Any ways round this at all
God, I need a smoke now, after typing all this

Anything is appriciated (except the comments like "HUH")


Tell me the problem, I will try tell you the solution

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 20 September 2006 - 12:56 AM

Does this mean, if the web server has php gtk installed, then the user does not need to install PHP GTK


No... the client will still need php-gtk installed. What you are best off trying to do (if you really want to try and hide your code) is let your processing be done on the server with plain php. This would be the bussiness layer of your application. You then need to have all your php-gtk (gui stuff) on the client. This allows you to hide most of your logic, while your application remians semi-efficient.

Ideally, your best option would be to have the entire application run on the client and have a good license in place.

Another and IMO the best option (though it may involve learning a new language) would be to switch your entire application to python. There are plenty of py to exe compilers around and python's gtk implimentation is much stronger then php's. I used to write php-gtk applications for a living before moving all my applications to python. Im sorry, but I just don't believe php is very strong in this area. Its gtk implimentation feels flaky at best, bordering on buggy. I just always get the feeling its about to crash. Python is rock solid in this area and really, for desktop applications python has a much larger / more versatile system api.

#3 kksou

kksou
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 21 September 2006 - 05:32 PM

SO
I was thinking about storing the .php files on a Web Server, and the user installs the GTK stuff, and has the phpw file
Which they run, and uses the file from the website


Let me try to answer your question.

Just remember that php-gtk is used to display GUI on whatever machine it is running on.

Even if you're able to fire up php-gtk on the remote server (e.g. with your example of include('http://www.example.com/gtk/main.php')), you won't be able to see anything at the client side. The php-gtk is running on the server, and the output does not "propagate" via network to be displayed on the remote client.

You can, however, include some files from a remote server.
For example, try this example: (Note: you need to have php-gtk2 installed on your machine.)
<?php
include "http://www.kksou.com...lo_world.phps";
hello_world();
?>

You should be able to see this:
Posted Image

You can see a full explanation here: http://www.kksou.com...---Method-1.php

This method does not "protect" your code at all. Just type the url: http://www.kksou.com...ello_world.phps into your browser, and you will see the entire content of the file displayed. "Protection" is not the main purpose for this. We use this more for ease of maintenance and updating of php-gtk application over large number of sites.

thorpe mentioned about hiding the bussiness layer of your application with a server in his reply to you. You can find an example here: http://www.kksou.com...on-securely.php

So, in short,
1) Yes, you have to install php-gtk2 on all machines that wants to run your php-gtk2 scripts. (Unless, of course, some php-gtk2 compilers come out later that allows you to compile everything into a standalone .exe)

2) The server can run php-gtk2, but you won't be able to see it from your client side. We use the server for other purpose, as described above.

3) If I understand correctly, your intention of putting your codes on the server is to try to hide your script away from the user. As mentioned above, because you're using an "include" statement, the user can easily grab a copy of that file.

As for the comments from thorpe with regards to python's gtk, I agree it's a much more established platform than php-gtk2. We almost wanted to switch over to using python initially. However we finally decide to stay with php for 2 main reasons:

a) We do a lot of web programming. Sharing codes between our web application and php-gtk is so much easier. We could use the same library, just different front-ends.

b) Comparing Python with PHP is like comparing Microsoft Windows and Mac. In real life, sometimes the best just aren't the most popular. If you use OO a lot, you will know that PHP still lags behind Python. But the fact is that the PHP community is much larger than the Python base. This means there are more support available, including documentations, forums, codes, etc. For companies, it also means a large pool of PHP programmers for them to choose from.





#4 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 21 September 2006 - 07:31 PM

I was not trying to fire up the app on the server, just that the user will grab the files from the server, but it will run on his/hers machine
Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users