Page 1 of 1
Client side PHP
Posted: Sat Jun 08, 2002 12:01 pm
by phphead
Im wondering, who here uses php on the clientside? Php is basicly a virtual machine.
I use php all the time on the client side, Its a very powerful language with alot of features and its very cross platform.
PS: what is with all of the rest of the open source world bashing windows.
i mean they think that windows users are incompent lusers.
?
Posted: Sat Jun 08, 2002 1:24 pm
by BDKR
Ok..... I'm game. How do you use php client side? if you have some way of deploying hunks of php code to clients systems (whether or not they have it installed) and it runs with success (whether or not they have a php scripting engine installed), I'm curious to know.
Otherwise, what's wrong with Javascript? Too me, it's very similar. Much more object oriented than PHP, but tha's OK too. Variables don't have the "$" preceeding them wich make it tougher to read IMHO, and associative arrays seem tougher to deal with.
As for the php being a virtual machine, I'm not to sure I agree with you 100% percent. Java's JVM (the VM meaning virtual machine) executes COMPILED CODE. That's a lot different then the scripting engines of PHP, Perl, or Python, which parse through text (the script itself) before executing.
But oh well......
Big Din K.R.
Posted: Sat Jun 08, 2002 1:50 pm
by fatal
Posted: Sat Jun 08, 2002 1:51 pm
by jason
Just a quick clarification:
1. Java is not truly a compiled language. It compiled down to byte code, which is in turn, interpreted by the JVM.
2. I think ( I hope ) he was refering to PHP-GTK.
Posted: Sat Jun 08, 2002 2:02 pm
by twigletmac
i mean they think that windows users are incompent lusers.
Who can't spell

.
Mac
Client side mumbo jumbo....
Posted: Sat Jun 08, 2002 11:24 pm
by BDKR
I think what some one is calling client side should be termed differently. By pointing me at php-gtk, I've figured out what the person is getting at. First off, when someone says "Client side" they are implying an "as opposed to" the server. Which in the php world "normally" means the browser.
Now even if you are not talking about the web, when one says "client side", they are implying the existince of a server. Client / Server architecture anyone? That said, what was referred to as client side programming is indeed not client side programming.
PHP-GTK is about bringing php to the desktop. Something about event driven applications? Now one can create a client type progam that runs from the desktop. One can do so using PHP-GTK too. But if that program doesn't contain anything like fsockopen(), socket_create(), socket_write(), yada yada yada...., can it be called a client side program?
So to answer the queystion, yes, i've written php scripts that run without web servers and don't terminate unless told. The only drawback I see is that when executed, you also get all of those native functions and other stuff you compiled in as part of the php executable, even though you may not be using them.
As an example, I (for the short term as my C is a little rusty) wrote using PHP a MySQL control server thingy that listens on a particular port and starts / stops / checks status / and issues commands related to replication as directed by either the cluster managers, transaction servers, or an admin. It works great and will do for now. But I'm not using a tenth of the available native php functions in the code. However, it's all there at run time. Using C, the executable would have only what functions were compiled into it therefore making the executable smaller and faster.
What I would like to see is a php compiler. That would be the bomb! PHP is just what I think a language should be. Dynamically typed and I'm free to use OOP or not. I can dream can't I?
Anyways, I am planning on doing some work with PHP-GTK. Perhaps those of you who have could help us out wtih some tutorials?
later on and sorry for the mis-understanding,
Big Din K.R.
Posted: Sat Jun 08, 2002 11:39 pm
by sam
Java is called a sudo-compiled language, it is compiled down into byte code that is then fed into the JVM, where as c++ is compiled down and fed into the operating system (or ideally into the CPU)... But this arises an interesting question. If JAVA is compiled down to byte code and run an a JEmbeded processor with the interpreter built into the chip does that make Java a truely compiled language? Just something to ponder...
Cheers Sam
Java and stuff....
Posted: Sat Jun 08, 2002 11:46 pm
by BDKR
Hi Jason,
You know, I still have to say that Java is compiled. However, I hear and understand what you're saying.
A good question would be "What is the JVM executing?" Another one would be "What is a VM?" And even another; "Why is there a JVM?"
Perhaps Java only gets "so compiled". More compiled than PHP but less than say C++? But even that doesn't really make sense. If you ask me, the answer is in the questions above. If a hunk of Java code ever hopes to run on more than one platform, it must be have a JVM that can interpret it to the particulars of a given platform. Therefore, there is one Java language (I'm not including MicroSoft's abortion), but many different JVM's as there are many different platforms.
The interpretation is done by the JVM. The code itself is compiled into something that the JVM can understand on the incoming side. The outgoing side is what is run on a given platform.
And seriously, what is the difference between a machine and a virtual machine?
What exactly is done to some source when it's compiled? Well whatever it is, it's more than what a scripting language does.
Later on,
Big Din K.R.
Posted: Sun Jun 09, 2002 2:33 am
by volka
If running in a apache as module does the ZEND engine keep the parser tree or is a script parsed from scratch every time it is requested?
Posted: Sun Jun 09, 2002 8:44 am
by jason
BDKR: Oh, yeah, don't worry, I know what client side refers to.

I was just hoping to clarify what I think he was intending to say. And as far as my "not truly a compiled language", maybe it would be better to say "not truly a compiled langauage when compared to C/C++". As far as tutorials are concerned, I wish I could, however, I haven't really done any PHP-GTK. I would rather do a GUI interface in Java (heh), C#, or VB, depending on my needs. Much quicker, in my opinion.
A machine is the real computer. A virtual machine is like a pretend computer inside a computer. The JVM basically pretends to be a computer, and the Java program operates within it. The JVM basically makes system calls to the actual computer to perform the functions. This is why Java seems bulky. Because it basically has to do more work to get to something (when dealing with windows at least). Note: This may not be as accurate as I would like it to be, simply me recalling as much information I think I remember from my Java reading.
The JVM is also needed to run Java. I can easily excute binaries on Linux or Windows without worrying about a C Virtual Machine. In a sense, Java still needs that JVM just as much as PHP needs the PHP binary.
Mas Java cosas
Posted: Sun Jun 09, 2002 4:58 pm
by BDKR
Hey Jason,
I hope I didn't seem like a punk the way I came across. I was asking a lot of rhetorical questions and realized it seemed like I was trying to baffle with BS.
Anyways, it seems like we are on the same page for the most part. Just approaching the same facts from differring angles.
Later on,
Big Din K.R.