简体   繁体   English

xampp 不运行 php,浏览器询问如何处理文件

[英]xampp does not run php, browser asks what to do with file

I just installed xampp from www.apachefriends.org.我刚刚从 www.apachefriends.org 安装了 xampp。 Per the instructions I ran sudo ./xampp-linux-*-installer.run Then xampp started and I saw the gui control panel.根据我运行的说明 sudo ./xampp-linux-*-installer.run 然后 xampp 启动,我看到了 gui 控制面板。 Everything great so far.到目前为止一切都很棒。 I verified it works by going to localhost in Firefox.我通过在 Firefox 中访问 localhost 来验证它是否有效。 I saw the welcome screen.我看到了欢迎屏幕。

Then,I navigate to my test html.然后,我导航到我的测试 html。 It is a contact which runs a php file when clicking submit.它是一个在单击提交时运行 php 文件的联系人。

Then firefox sends a message what to do with my php script, sendeail (save or select an application).然后firefox发送一条消息如何处理我的php脚本,sendeail(保存或选择一个应用程序)。 sendeail is a no-brainer php script for email which I found on the internet years ago. sendeail 是我多年前在互联网上发现的用于电子邮件的简单 php 脚本。 It works when running from my server and has been for ages.它在从我的服务器运行时工作,并且已经存在了很长时间。 Just now running locally with xampp started, Firefox doesn't know what to do with it.刚刚在本地运行启动了xampp,Firefox 不知道怎么处理。

What should Firefox do with this file? Firefox 应该如何处理这个文件?

Do I have to configure xampp somehow?我必须以某种方式配置 xampp 吗?

I couldn't test in Opera or Chrom(ium), the submit form doesn't appear for some reason on my local computer, but whose browsers work fine when accessing the page on the server.我无法在 Opera 或 Chrom(ium) 中进行测试,由于某种原因,我的本地计算机上没有出现提交表单,但是在访问服务器上的页面时,其浏览器工作正常。

I am running in Linux Ubuntu 16.4 LTS, Firefox 65.0.1 64-bit我在 Linux Ubuntu 16.4 LTS、Firefox 65.0.1 64 位上运行

--- edit --- - - 编辑 - -

Specifically, the question is that the web browswer sees the .php file and tries to open it, what must I do for the web browser to be passed the code within the .php file, instead?具体来说,问题是网络浏览器看到 .php 文件并尝试打开它,我必须做什么才能让网络浏览器传递 .php 文件中的代码?

.apachefriends.org has no explanation of this. .apachefriends.org 对此没有解释。 I found another page which explains, https://www.fayazmiraz.com/how-to-run-your-first-php-code/ .我找到了另一个解释的页面, https://www.fayazmiraz.com/how-to-run-your-first-php-code/

One has to put their php code into /etc/xampp/htdocs必须将他们的php代码放入/etc/xampp/htdocs

That's so counter-intuitive!!!这太违反直觉了!!! OMG why can't I keep my files in my development directory. OMG 为什么我不能将我的文件保存在我的开发目录中。 Yeah, I can test this way, but I'll have to keep updating that directory whenever I have a program change!是的,我可以通过这种方式进行测试,但是每当我更改程序时,我都必须不断更新该目录! Thank you谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM