PHP xampp 下载我的 index.php 而不是加载页面

标签 php xampp

所以我的 PHP 项目导致 localhost以及 localhost/project/正在下载 index.php对于项目而不是加载它,它会将其下载为 download ...这里是 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');

并加载 localhost下载这个:
<?php
    if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
        $uri = 'https://';
    } else {
        $uri = 'http://';
    }
    $uri .= $_SERVER['HTTP_HOST'];
    header('Location: '.$uri.'/xampp/');
    exit;
?>
Something is wrong with the XAMPP installation :-(

最佳答案

我有同样的问题(使用 Ubuntu 12.04)并且在 .htaccess 中也有一行像 pi4r0n,例如,

AddHandler application/x-httpd-php54s .php

XAMPP 的 PHP 版本与 AddHandler 不同。命令正在调用(我的有 v5.3.8)。我发现将其注释掉,就像 pi4r0n 所做的那样,即
# AddHandler application/x-httpd-php54s .php

将允许它在本地服务器上工作。您只需要记住在上传之前更改它。

关于PHP xampp 下载我的 index.php 而不是加载页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17631299/

相关文章:

Java JDBC 对要求仅返回特定行详细信息的 SQL 查询抛出错误

php - 在 CentOS 5.4 上运行 PHP 5.3 - fatal error Class 'PDO' 未找到

php - 以一种形式更改密码和更改电子邮件地址

php - 计算与之前 created_at 的时间差的最佳方法 - Laravel

php - 升级在 PHP 中 native 实现的 Olson tz 数据库

mysql - Xampp无法连接mysql数据库错误请检查数据库名称

php - 如何为 XAMPP 安装 PECL HTTP 扩展?

php - 为什么我们需要从 1970 年开始计算时间?

php - Laravel Eloquent 集合 sortBy 不生效

php - 下载Xampp并设置一个良好的工作环境?