所以我的 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/