Page 1 of 2 12 LastLast
Results 1 to 40 of 54

Thread: Is php compiled?

  1. #1

    Thread Starter
    Hyperactive Member BrandonTurner's Avatar
    Join Date
    Sep 2001
    Location
    East Lansing, Michiagn
    Posts
    268

    Is php compiled?

    my friends says that php is compiled. I think it is just intercepted by the server and changed(rendered) into html and then your browser shows it to you. He thinks it compiles the source and the server runs the appilcation. Anyone know for sure?

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    PHP is a scripting language, however, there are compilers which can take a PHP script and turn it into a program.

    Also, wrong forum and you could have confirmed this in .00000003547 seconds with google.

  3. #3

    Thread Starter
    Hyperactive Member BrandonTurner's Avatar
    Join Date
    Sep 2001
    Location
    East Lansing, Michiagn
    Posts
    268
    google really isnt giving me a straight answer. thanks for yours though.

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by BrandonTurner
    google really isnt giving me a straight answer. thanks for yours though.
    http://www.google.com/search?q=defin...utf-8&oe=utf-8

    Very first definition on the very first line "scripting language".

  5. #5

    Thread Starter
    Hyperactive Member BrandonTurner's Avatar
    Join Date
    Sep 2001
    Location
    East Lansing, Michiagn
    Posts
    268
    Originally posted by kasracer
    http://www.google.com/search?q=defin...utf-8&oe=utf-8

    Very first definition on the very first line "scripting language".
    yeah, i did that afterwards to prove it to him. As a side note... are you from genmay?



    allnighte

  6. #6
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by BrandonTurner
    yeah, i did that afterwards to prove it to him. As a side note... are you from genmay?



    allnighte
    I was from Genmay until M|22 paid for my SA membership and I haven't looked back since.

  7. #7

    Thread Starter
    Hyperactive Member BrandonTurner's Avatar
    Join Date
    Sep 2001
    Location
    East Lansing, Michiagn
    Posts
    268
    ahhh. why did he pay for the SA account, you like being a Goon?

  8. #8
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by BrandonTurner
    ahhh. why did he pay for the SA account, you like being a Goon?
    He paid for it because I was whinning about how the Admins were retards who couldn't do their job correctly and fairly. Sanjay responded by changing my name about 4 different times in 1 thread before M|22 bought me my SA membership and premium and then banned me.

    Being a Goon is awesome.

  9. #9
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    Aren't ALL languages compiled in one way or another? Even an interpreted language is changed/compiled so your computer can read it. It has to be turned into 1's and 0's otherwise your processor will spit it out. Where compiled into an executable or processed on the fly every language is compiled.

    BTW, I am a professional PHP developer.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  10. #10
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Arc
    Aren't ALL languages compiled in one way or another?
    No. Scripting languages != Compiled

  11. #11
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Spetnik
    Some scripting languages are compiled at runtime. I don't know which, offhand, but I do know that some are.
    .NET?

  12. #12
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    A language can not be proccesed by a computer unless it has been compiled. Therefore PHP = compiled.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  13. #13
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Originally posted by Arc
    A language can not be proccesed by a computer unless it has been compiled. Therefore PHP = compiled.
    How did you come to that conclusion?

    A compiled language is one which is run by being compiled into machine code. An interpreted language is one which is interpreted by a precompiled binary.

    Yes - PHP has to be translated into machine code but this is done by a separate program. Where as a compiled program written in C would be able to run standalone.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  14. #14
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    PHP is not compiled in a sense that ASP .NET is. In fact there is a commercial solution available from Zend that tries to mimic compilation called Zend Accelerator.

    BrandonTurner: Don't get into the argument of proving PHP is better or ASP or ASP .NET. It's just a headache, and almost always accompanied by prejudice.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  15. #15
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Arc
    A language can not be proccesed by a computer unless it has been compiled. Therefore PHP = compiled.
    I thought you were a professional PHP developer?

  16. #16
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Spetnik
    I know many professional developers who have not a clue as to how languages work.
    That's just...... bad

  17. #17
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Spetnik
    Why is that? They are good programmers, have jobs, and make money. What more do they need?
    I think if you're using a language, you should know how it works.

  18. #18
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    There are indeed scripting languages that get compiled. E.g. the Rhino JavaScript engine, which is written in Java, can compile JavaScript to Java bytecode.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  19. #19
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by CornedBee
    There are indeed scripting languages that get compiled. E.g. the Rhino JavaScript engine, which is written in Java, can compile JavaScript to Java bytecode.
    JavaScript isn't compiled by default, you have to use a 3rd party tool to do it. The same is with PHP (which I mentioned earlier). Some people actually develop applications in PHP. A scripting language, by deifnition, isn't compiled. Doesn't mean someone can't come along and make a compiler for it though.

  20. #20
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Spetnik
    You did not answer my question. Why would they need to know how it works if they are doing perfectly fine without it?
    To better themselves? If you're a professional PHP developer but don't know how PHP works, that is pretty bad and they better hope no one finds out.

  21. #21
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    They could be doing better than just "perfectly fine" if they knew how the language works under the hood. I see it all the time with my brother. He hasn't got a clue about programming language fundamentals (don't confuse it with programming fundamentals), and thus his code could be far more efficient.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  22. #22
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Originally posted by kasracer
    JavaScript isn't compiled by default, you have to use a 3rd party tool to do it.
    By default?
    That really leads only to a discussion about the definition of a scripting language. For example, emacs uses scripts written in a scripting language - but they always get compiled to some intermediate form.
    Does that make it not a scripting language?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  23. #23
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Spetnik
    I am not saying that knowing how a language does not help. All I am saying is that there are many professional programmers out there who do not know exactly how the technology works, yet they produce quality code, and are making large salaries, and therefore, they have no immediate need to learn what goes on at the low-level of their systems. That's all.
    I highly doubt they're producing 'quality code'

  24. #24
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by CornedBee
    By default?
    That really leads only to a discussion about the definition of a scripting language. For example, emacs uses scripts written in a scripting language - but they always get compiled to some intermediate form.
    Does that make it not a scripting language?
    Then it wouldn't be a scripting language. Google's definitions are NEVER WRONG!

    scripting language - A scripting language differentiates itself from other typical languages in that they are usually simpler to learn and use as well as not needing to be compiled. The language is interpreted at run-time so you can execuate instructions immediately.

  25. #25
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Scripting Language != Script but those definitions don't disprove what I said.

  26. #26

    Thread Starter
    Hyperactive Member BrandonTurner's Avatar
    Join Date
    Sep 2001
    Location
    East Lansing, Michiagn
    Posts
    268
    one of the thing i thought about to logically prove my point was the fact that there is such a thing as PHP injection exploits. If it was compiled putting code into the program would just mess up the program not cause it to do what you put into it. Then my friend said that it is possible to have injection becuase it is compiled line by line as it goes during run time which sounded reasonable i guess.

  27. #27
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Originally posted by Spetnik
    I am not saying that knowing how a language does not help. All I am saying is that there are many professional programmers out there who do not know exactly how the technology works, yet they produce quality code, and are making large salaries, and therefore, they have no immediate need to learn what goes on at the low-level of their systems. That's all.
    You are right about that.

    My very nature is to question things and that is the only reason I know how VB programs and C programs are compiled and it does give you an upper hand beucase sooner or later there will be an error in the compiling or linking of a program and you're screwed if you have never seen that kind of error before.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  28. #28
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Originally posted by BrandonTurner
    one of the thing i thought about to logically prove my point was the fact that there is such a thing as PHP injection exploits. If it was compiled putting code into the program would just mess up the program not cause it to do what you put into it. Then my friend said that it is possible to have injection becuase it is compiled line by line as it goes during run time which sounded reasonable i guess.
    No, you're getting the program to jump from the interpreter's code to the malicious injected code.

    Compiling line by line as you go through a program is horribly inefficient - compiling a line takes longer than interpreting it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  29. #29
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    I never said PHP could be compiled into a stand alone app. I was merely making the point that all languages must be turned into machine code at some point in order for the processor to understand waht it means. A processor can not read any language, be it a stand alone compiled exe or a scripted php page. They all must be turned into machine code in order for them to be usable and isn't that exactly what compilation does?

    I was using the definition of compilation which basically means "Change to machine code" and if you look at it like that then yes all languages must be compiled. Therefore , in a sense, all languages are compiled languages.

    If you look here you will see that the Computer Science definition for Compile is To translate (a program) into machine language.


    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  30. #30
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Its more than just translating the source code into machine code.

    If you did that then your program wouldn't work.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  31. #31
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, arc, not all languages must be compiled. Interpretation means to invoke already existing machine code bits according to a text pattern. This is not compilation, where machine code is created according to a text pattern.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  32. #32
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Unless any of you have built a compiler, I guess you are disguising intelligence on the matter behind what you have read in a book, or on the web.

    Look at Java for instance... it's a supposed write-once run-everywhere platform. That's all fine for the programmer, but not the guy that has to create a compiler for that bytecode for each processor platform on the market.

  33. #33
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196
    Originally posted by CornedBee
    They could be doing better than just "perfectly fine" if they knew how the language works under the hood. I see it all the time with my brother. He hasn't got a clue about programming language fundamentals (don't confuse it with programming fundamentals), and thus his code could be far more efficient.
    ...but i bet your brother has got:

    > a girlfriend and/or a healthy interest in the opposite sex
    > a social life
    > assorted interests OUTSIDE of work/computing
    > a glowing complexion



    ...sorry couldn't resist

  34. #34
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Originally posted by nemaroller
    Unless any of you have built a compiler, I guess you are disguising intelligence on the matter behind what you have read in a book, or on the web.

    Look at Java for instance... it's a supposed write-once run-everywhere platform. That's all fine for the programmer, but not the guy that has to create a compiler for that bytecode for each processor platform on the market.
    I'm not disguising anything. What I talk about here is indeed mainly what I've learned from books or the web. But no matter the source of my knowledge, I have this knowledge, unlike some other people here.

    And what has your Java example to do with it? This guy gets paid by Sun for what he does.

    powdir: I don't know what a glowing complexion is, but the others are all true
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  35. #35
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Point of the JAVA example:

    It distinguishes between the programmer (user), who knows nothing of what goes on under the hood, from the engineer (supplier), that wrote the code to convert it to machine language. You may read the white papers and comprehend how it works, but unless you wrote the code, you can't ever truly understand how it works.

    In context of this debate of php being compiled... A person may know C++, ASM, JAVA, and/or PHP. And all those don't work unless compiled or interpreted into machine code for a specific processor.

  36. #36
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    The difference between compilation and interpretation is that interpretation doesn't translate to machine code, never.
    "Interpreted to machine code" doesn't have a meaning.

    You may read the white papers and comprehend how it works, but unless you wrote the code, you can't ever truly understand how it works.
    Sure I can. I don't understand every detail, but I understand the process. And this is what we're talking about here. The question is not, "to what machine code is PHP compiled", but "is PHP compiled at all". Unless I wrote the PHP "compiler" (whatever), I couldn't answer the first question, but I can answer the second.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  37. #37
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Arc
    Randomly spouted stuff here
    We already know what you ment and it is wrong. Sorry Mr. PHP Professional.

  38. #38
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    Originally posted by Spetnik
    Wrong. A scripting language is not translated into machine code, because it is not processed by the operating system directly. It is processed by the scripting engine, which is a precompiled application that performs tasks based on code written in the script. The same way that machine code is what the operating system understands, so too, the actual scripting code is what the scripting engine understands.
    The final result is that that PHP script is eventually translated into MACHINE CODE! It has to be one way or another. Whether directly compiled or translated through a pre compiled parsing engine it is still translated into machine code.

    Why is this so hard to understand?

    And as stated above the definition of compile is to translate into machine code. How it got translated is irrelevant.

    But if you want to go by the normal consensus, then no PHP is not recognized as a "compiled" language, even though technically all languages are.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  39. #39
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Arc
    The final result is that that PHP script is eventually translated into MACHINE CODE! It has to be one way or another. Whether directly compiled or translated through a pre compiled parsing engine it is still translated into machine code.

    Why is this so hard to understand?
    It's so hard to understand WRONG consepts. Just stop when you're beaten. PHP is not compiled, which you first said. You're slowly changing your wording to try and make it look like you're right.
    Originally posted by Arc
    But if you want to go by the normal consensus, then no PHP is not recognized as a "compiled" language, even though technically all languages are.
    This is the dumbest, most ignorant comment I've ever seen on a forum.

    If I were you, I'd just delete that post and make like nothing ever happened, seriously......

  40. #40
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Slow down kas.


    Arc, you seem to have a wrong concept of what "compiled" means. I'm strongly considering writing a tiny scripting language to show you where you are wrong, but I'm pretty busy.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width