will be asking 2 new ones

Discussion in 'Scripting & Programming' started by kobem, Sep 23, 2007.

  1. kobem

    kobem Megabyte Poster

    1-i nearly got the phpnuke thing , however there are some new ones waiting to be asked

    first , if a client wants to display a php file in web server , web server calls "php interpreter" after
    finishing the process about php part , it returns the page to web server as HTML then it is sent to browser of the client

    why HTML ? i ask this because "php interpreter" does his job . After
    doing it web server can recognize the page now . So it will be sent as PHP to the client browser!

    ( think that client wants html , there is no need to interpret like in php , only sending it to the browser
    we can't see codes if its html neither . )

    2- why do we need to copy html folder in php directory to the apache/htdocs ?
    Certifications: CCNA
  2. derkit

    derkit Gigabyte Poster


    Certifications: MBCS, BSc(Hons), Cert(Maths), A+, Net+, MCDST, ITIL-F v3, MCSA
    WIP: 70-293
  3. dmarsh

    dmarsh Petabyte Poster

    We've already explained all this to you multiple times, php is serverside scripting language, browser does not understand php it understands HTML !!!

    For the love of god man ! Go and read and study, learn one subject and learn it well, learn all the concepts from the ground up, pick the most basic stuff first. If you have trouble doing this take someone elses sylabus like the CIW. Read around the subject ! Every new thing you learn ensure you understand how it works in depth, test your assumptions. Try to predict what will happen, then observe what does happen. Try to understand what the creators or designers were thinking, why things are the way they are. Recognise whats good design, whats a historic artifact or just random stuff / poor design.
  4. kobem

    kobem Megabyte Poster


    sorry man , i feel too bad in these days , i read all things at least 50 times:cry:
    Certifications: CCNA
  5. dmarsh

    dmarsh Petabyte Poster

    You just need to step back and start from the beginning ! :biggrin

    Theres certain prerequisites for anything, you obviously don't have the prerequisite knowledge... YET !

    You need to go get that knowledge, the best way to do that is start from the BEGINNING, and build up slowly !

    Do people train for the marathon by going out on race day and running 26 miles ? NOOOO !!!

    They condition their mind and body for YEARS !!!

    Shaolin Monks believe that their body changes after 7 years of training, that their bones become like steel...
  6. JonnyMX

    JonnyMX Petabyte Poster

    This might help...
    Certifications: MCT, MCTS, i-Net+, CIW CI, Prince2, MSP, MCSD
  7. Fergal1982

    Fergal1982 Petabyte Poster

    php, as has already been described, is a server-side language. Its used to perform programming-like functions to produce output to the screen. Lets take a very basic example of a login page.

    You are presented with a login page that is a basic html page, containing a form with input fields for username and password. when you enter these details, and click on "login", the form posts your details to the specified page (lets say authorise.php). When authorise.php is requested, the IIS (or apache or whatever) doesnt know how to deal with php files, so it passes them to the php service. Within this page are sections of HTML and PHP code (it looks/acts very much like C code).

    Now, in this example, the authorise.php source will query the database for any users by the name given in the username field. if there are matches, it will check the password field to verify that the passwords match. If everything is ok, the php code will go down a route that writes out a successful login screen, if not, then it will take it down the non-successful route. Both outputs are the same page, but the actual data is different. Let me show you an example code (Ill write it in plain english so you can see whats happening. so this isnt ACTUAL code that you could use):

    "Login Database - My authentication details are Username: phpserver1, Password: phpserver1"
    "Login Database - Is there a user with a username of 'davey', and a password of 'jones'?"
    If Login Database says "Yes" Then
    (Theres a user)
    Write to the browser: "<p>Congratulations, you are now logged in</p>"
    Else If Login Database says "No" Then
    (No User)
    Write to the browser: "<p>Boo. Bad Monkey, no login for you!</p>"
    End If
    Now, With server-side programming, only the sections that say "Write to the browser" are produced into an HTML format. One of the primary reason for this, is to allow database access calls that are more secure. Imagine if everything in the above example was written to the browser. Any user smart enough to click on 'View Source' would be able to see what the username and password for the Database.

    This also allows for dynamic sites to exist on the web. Think about amazon. When you click on the 'View my cart' button, the page it loads has to be dynamic. It has to load up a list of all the items you have added to the cart. Now there isnt someone sitting at amazon HQ manually writing an HTML page for every user whenever they click on the view cart button. its done automagically through something like php.

    Its output to HTML because the server and the browser dont understand the language php uses. thats why the pages are passed to the php interpreter: to allow the code to be interpreted into something that the server/browser understands (HTML). Even if the browser could understand the php language (the browsers can actually understand vbscript at the moment), you have no way of ensuring that the person viewing the page has disabled the vbscripting stuff on their browser. All you can control is the server. So the scripting techniques have moved onto the server, with HTML being passed out to the viewers (after all, theres no way to disable html in a browser). This all but guarantees that the dynamic sites will run on all browsers, regardless of platform, setup, etc.
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  8. stuPeas

    stuPeas Megabyte Poster

    PLEASE TAKE THIS ADVICE!!!!! You will find that if you learn something from the beggining you will not be asking the same question over and over again. Its no good reading the replies 50 times if you dont try to understand what the replies are telling you.

    Even when you think that somebody has answered your question, believe me you STILL WILL NOT UNDERSTAND it properly untill you go to the start and learn all the little facts that make up the whole topic.

    You CANNOT understand PHP and server file configuration if you dont FULLY understand what a SERVER-SIDE scripting language is, and where it is executed and why.
    Certifications: C&G Electronic, CIW Associate (v5).
    WIP: CIW (Website Design Manager)

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.