PHP xampp下载my index.PHP而不是加载页面
因此,我的PHP项目导致PHP xampp下载my index.PHP而不是加载页面,php,xampp,Php,Xampp,因此,我的PHP项目导致localhost以及localhost/project/正在下载项目的index.PHP而不是加载它,它以download的形式下载它……以下是下载文件: <?php /* * Index.php - Define the directories * * * DS, DIRECTORY_SEPARATOR = / * ROOT, dirname = string containing the path of a file or directory * __F
localhost
以及localhost/project/
正在下载项目的index.PHP
而不是加载它,它以download
的形式下载它……以下是下载
文件:
<?php
/*
* Index.php - Define the directories
*
*
* DS, DIRECTORY_SEPARATOR = /
* ROOT, dirname = string containing the path of a file or directory
* __FILE__ = The full path and filename of the file. If used inside an include, the name of the included file is returned
*
* In this file we load the apporpriate files that our website wants to load and render the
* template with informatio from the database. We load the bootstrap.php from the library folder.
*
* We are not including the ?\> to avoid injection of any extra whitespaces in our output.
*
*
*/
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(dirname(__FILE__)));
$url = $_GET['url'];
require_once (ROOT . DS . 'library' . DS . 'bootstrap.php');
伙计们,我也有完全相同的问题,在我的情况下,这是htaccess文件。我错误地从我的服务器(cPanel服务器)下载了它,htaccess如下所示 #使用PHP5.4作为默认值 AddHandler应用程序/x-httpd-php54.php 但是因为我没有在XAMPP上本地安装PHP5.4,所以它不知道如何处理该文件 因此,我的建议是确保您的htaccess文件(如果有)已删除或正确;) 我也有同样的问题(使用Ubuntu 12.04),在.htaccess中也有一行,比如pi4r0n
AddHandler application/x-httpd-php54s .php
XAMPP没有与调用的AddHandler
命令相同的PHP版本(我的版本是v5.3.8)。我发现,正如pi4r0n所做的那样,对其进行注释
# AddHandler application/x-httpd-php54s .php
将允许它在本地服务器上工作。你只需要记住在上传之前对它进行更改。我的Ubuntu桌面电脑也有同样的问题。我使用filezilla(或任何其他文件浏览器)从父目录中删除了一个隐藏的htaccess文件 这就解决了。返回正常网页显示
(我不确定该htaccess文件对桌面计算机是否重要,但我确定我没有在live server上添加该文件。因此我删除了它。如果我错了,请告诉我)这是针对MAC版本10.15.4的 如果已安装XAMPP,可以尝试将以下行添加到位于/Applications/XAMPP/xamppfiles/apache2/conf的httpd.conf AddType应用程序/x-httpd-php.htm.html 如果我不工作,请尝试删除浏览器的缓存或重新启动计算机
注意:如果在同一根目录下有.htaccess文件,则应将其删除,以防止浏览器下载您的php或html文件。除了更新php.ini文件和设置enable_post_data_reading=On外,还应确保启动XAMPP(转到安装位置并双击XAMPP_start)您可能没有为apache加载PHP模块?您知道如何在ubuntu上手动加载此模块吗?我将搜索并试用它。你真的在Ubuntu上使用XAMPP吗?我是说,阿帕奇朋友的东西他们甚至连自己的网站都做不好(或者“元标题”应该是实际的页面标题吗?)。只要“sudo apt get install apache2 php5 libapache2-mod-php5 mysql”就可以了……嘿@germainelol,你真的找到了解决方案吗。我想我遇到了完全相同的问题……我不认为这是php处理程序的问题。检查index.php文件是否具有执行权限。请尝试“chmod 644 index.php”。为index.php授予644权限。它会解决:)谢谢,它在我的mac电脑上工作。我努力寻找使它起作用的原因,并遵循所有可用的答案。最后,只需在.htaccess文件中对上述内容进行注释即可。
# AddHandler application/x-httpd-php54s .php