【发布时间】:2016-11-16 08:51:57
【问题描述】:
我用作曲家下载了它。尝试使用 PHPStorm 的内置服务器运行,但它不加载工具栏 (404)。
然后我尝试用 Apache 运行它,我将我的项目复制到/var/www/html,然后我在浏览器中转到http://localhost/symfony_app/web/app_dev.php。
奇怪的是它部分显示了源代码(但没有换行):
loadClassCache(); $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send(); $kernel->terminate($request, $response);
这个文件(完整)有以下源代码:
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
/**
* @var Composer\Autoload\ClassLoader $loader
*/
$loader = require __DIR__.'/../app/autoload.php';
Debug::enable();
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
在 Apache 错误日志中什么都没有,只是重新启动。
该应用程序在 Symfony 的内置服务器上运行良好,在端口 8000
【问题讨论】:
-
当您尝试访问 apache 下的页面时,究竟显示了什么?
-
好像您没有在 Apache 中安装或配置 PHP 模块。
-
@cilefen 但我不会看到所有代码而是从
loadClassCache()看到的(甚至没有$kernel->loadClassCache()) -
@mmmm 一个没有格式的白页,就是我描述的那个