Browser ask me to download php file(浏览器要求我下载 php 文件)
问题描述
我是网络编程的新手,仍在学习新东西.
I am a new guy in web programming who still learning new stuff.
我正在创建一个包含一个 INPUT 的 Web 表单.我将 HTML 文件中的表单连接到 php 文件.我正在使用我最近在 MacBook 上安装的本地主机 MAMP.
I am creating a web form that consist of one INPUT. I connected the form in the HTML file to the php file. I am using a localhost MAMP that I recently installed on my MacBook.
问题: 当我在网页上打开 HTML 文件并在输入框中输入内容并点击提交时,浏览器要求我下载 php 文件而不是处理它.
The Problem : When I open the HTML file on a webpage and type something on the input box and hit submit, the browser ask me to download the php file rather processing it.
我认为问题与 mysql 或 apache 无关,因为当我运行 MAMP 时,它会在 apache 和 mysql 旁边给我绿色标志.
I don’t think the problem is related to mysql or apache since when I run the MAMP it give me green signs next to the apache and mysql.
有谁知道我如何解决这个问题并让 php 文件打开并将输入传输到数据库?
Do anyone know how I can fix this problem and the let the php file open and transfer inputs to the database?
推荐答案
您需要确保 Apache 已被告知 .php 文件应被视为 PHP 脚本.这意味着以下之一:
You'll want to make sure that Apache has been told that .php files should be treated as PHP scripts. That means one of the following:
LoadModule php5_module modules/libphp5.so # on windows, this'd be a .dll instead
AddHandler php5-script php
和/或
AddType application/x-httpd-php php
在您的 httpd.conf 文件中.
in your httpd.conf file.
这篇关于浏览器要求我下载 php 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:浏览器要求我下载 php 文件


基础教程推荐
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01