开发者

Php code giving no results in firefox? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.

This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.

Closed 12 months ago.

Improve this question

Just started learning Php on my own, and got stuck at the beginning. This is the code I was compiling:

<?php
  echo "Hello world!";
  echo 6+开发者_开发百科2;
?>

The problem is that the Php portion isn't displayed in Firefox. Why? Firefox ver. 7.0.1., I am using NetBeans 7, with cygwin.


You said you're accessing the file directly like file:///C:/xampp/htdocs/PhpVjezba1/test1.php

Don't do that, access it via http://localhost/PhpVjexba1/test1.php, provided you have a server installed.

Click Here


Most likely, you haven't installed php on the server yet. Unlike JavaScript and HTML, php is interpreted at the server, and that requires

  1. a webserver (like apache)
  2. a php runtime
  3. php to be configured

The documentation's installation chapter explains how to install php. There are also third-party distributions like XAMPP that try to simplify the installation process.


In the comment you have the problem. You cannot access the file directly.

Start the webserver and run the file "http://localhost/file.php" then the file should work.


Probably a stupid question, but are you running PHP from web server or actually trying to run the file directly in browser?


PHP is never displayed in any web browser, it is executed on a web server, and is used (somewhat) to produce html that is displayed to you're web browser.

Do you have a local browser such as wamp?


Does the output display in other browsers?

Does your page have the .php extension and is your server set to handle php?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜