Jump to content

Code not working


jimfog

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.

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?

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...