Deviant Logo

Problem with viewing PHP in Firefox?

post details top
Jun 9th, 2010
post details top


I have Firefox 3.5b4, and i saved this code as a PHP file (on my PC):




one


When i open the php file in firefox, this is the output:
one

the problem is that ‘two’ doesn’t show up. Why is this and is there a way to fix it?

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

6 Comments

  • timtamboy63

    have you actually installed php and apache(or IIS) on your computer?

  • Germann A

    PHP file should be SERVED by web server (Apache) with PHP enabled (mod_php)
    If it runs on YOUR computer you should be accessing it as
    http://localhost/yourPHP.php

  • Tizio 008

    the php is not interpreted or read by the browsers! it needs to be interpreted, and this interpretation is done *before* sending the data to a browser.
    this means that you can’t open a local “php” source directly with the browser and pretend it executes the code!

    you must install/activate a web server (with php interprer) on you machine, and you must access the file through the local web server, as if it were online (e.g. you write http://localhost/mysite/myphp.php )

    doing so, the web server “listen” to the request of the “myphp.php” file from the browser, before sending it, the server will pass it to the php interpreter, and the result of such processing will be sent, through the web server, to the browser.

    a web server e.g. is apache (it exists also IIS by microsoft)

    you can find interesting the following link
    http://www.wampserver.com/en/

  • rowlfe

    PHP runs at the server level. You need to install a local PHP package on your machine in order to become a server for this code to work, otherwise only the HTML is being interpreted, which is why the ONE is seen. The browser simply interprets the < ?php echo "two"> brackets as simply another tag, which it ignores as it does not know what to do with it. Once you install a local PHP package, it will work as advertised just as it does at the server level from a remote server returning the page.

Leave a Reply

Search

  • Partner links