搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Installed PHP, and it works on command line, but Firefox won't execute "test.php" Is there a setting I missed?

  • 2 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 DisneyWizard

more options

How do I tell Firefox that, or where, PHP exists, and to execute script? I installed PHP 5.3 as per msVista (basic) instructions on php.org to C:\Program Files\PHP\ and it works if I open cmd on the command line : C:\Program Files\PHP>php -a Interactive mode enabled ^Z and scripts in tags work properly.

However opening a page or file such as test.php containing valid script with Firefox 23.0.1 fails to interpret the script and just displays the uninterpreted source code as if it were text. I found that because C:\Program Files\PHP\ contains a space in the pathname the path needs to be enclosed within quotes "C:\Program Files\PHP\" [smacks forhead: shoulda installed to C:\PHP\ ] to be recognized. Is that the problem, and where do I make the change?

How do I tell Firefox that, or where, PHP exists, and to execute <?php php> script? I installed PHP 5.3 as per msVista (basic) instructions on php.org to C:\Program Files\PHP\ and it works if I open cmd on the command line : C:\Program Files\PHP>php -a Interactive mode enabled ^Z and scripts in <?php php> tags work properly. However opening a page or file such as test.php containing valid script with Firefox 23.0.1 fails to interpret the script and just displays the uninterpreted source code as if it were text. I found that because C:\Program Files\PHP\ contains a space in the pathname the path needs to be enclosed within quotes "C:\Program Files\PHP\" [smacks forhead: shoulda installed to C:\PHP\ ] to be recognized. Is that the problem, and where do I make the change?

被采纳的解决方案

Did your PHP installation package include a webserver (e.g., WAMP)? Generally speaking, the webserver will set up and take over port 80 and you can access your "site" using:

http://localhost/

Sometimes you may prefer to set up on a different port, for example, 8080, and then you would use:

http://localhost:8080/

As far as I know, there's no way to have Firefox stand in for a webserver and process .php files through the PHP interpreter itself. Of course, there might be an add-on for that...

定位到答案原位置 👍 0

所有回复 (2)

more options

选择的解决方案

Did your PHP installation package include a webserver (e.g., WAMP)? Generally speaking, the webserver will set up and take over port 80 and you can access your "site" using:

http://localhost/

Sometimes you may prefer to set up on a different port, for example, 8080, and then you would use:

http://localhost:8080/

As far as I know, there's no way to have Firefox stand in for a webserver and process .php files through the PHP interpreter itself. Of course, there might be an add-on for that...

more options

Missing WAMP ("Windows, Apache, MySQL, and PHP") WebServer. Sorry, not a Firefox issue. My mistake. Thanks for the solution.