Jump to content

Code not working


jimfog
 Share

Recommended Posts

I am new to php, so i decided to make a simple code and make it run.The code is the following(i used dreamweaver):

<?phpecho "Hello World";?>

It is the classic "hello world" text.When i opened the file containing the code in firefox i saw nothing-only white page, it does not work and i cannot explain why.In the beginning i tried to open a file using fopen but without results too, so o tried something simpler, a simple echo statement, but even that, it does not work, it does not appear in the browser.Obviously i am doing something wrong, but what?Any opinions regarding the matter.

Edited by jimfog
Link to comment
Share on other sites

a better test would be this

<?phpphpinfo();?>

it will verify that these conditions are met:http://www.w3schools.com/php/php_install.aspan alternative to installing all those yourself is to just get an AMP stack for the OS that you are using.In other words, do you have a server environment running locally on your computer that has PHP support?

Edited by thescientist
Link to comment
Share on other sites

Make sure your document name ends with the .php extension
yes, that helps too :) Edited by thescientist
Link to comment
Share on other sites

PHP is a server-side programming language. You need to actually run it on a server to actually see the output; you can't simply open the file in a web browser. The simplest way to test your output, I believe, would be to pick up XAMPP, which is a distribution of the Apache web server bundled with PHP, MySQL and Perl. Once you set it up, you can just place your PHP files in the server's directory and point your browser to localhost to view the page.

Link to comment
Share on other sites

PHP is a server-side programming language. You need to actually run it on a server to actually see the output; you can't simply open the file in a web browser.
I had forgotten( :) ) this little IMPORTANT detail.
The simplest way to test your output, I believe, would be to pick up XAMPP, which is a distribution of the Apache web server bundled with PHP, MySQL and Perl. Once you set it up, you can just place your PHP files in the server's directory and point your browser to localhost to view the page.
I have XAMPP and i will try what are you mentioning.
Link to comment
Share on other sites

  • 2 weeks later...

At last the code work.I just had to place the php file in the server(XAMM) directory and enter the proper web address in the address field of the browser(localhost/echotest.php).Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...