Hola, estoy teniendo un problema por demas extraño. My application no produce salida alguna, nisiquiera los headers.
PERO, si la ejecuto desde la shell(php5 index.php), funciona perfecto... la verdad no me lo explico.
Shell Output:
Código:
thaorius@Rhea:/var/www/octopus/public$ php5 --version
PHP 5.2.6-1+lenny2 with Suhosin-Patch 0.9.6.2 (cli) (built: Jan 26 2009 22:41:04)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
thaorius@Rhea:/var/www/octopus/public$ php5 index.php
Header<br />
Content: Hello Zend Framework!
<br />
Footer<br />
Ahora, desde el navegador no se ve nada, y si hago un wget para ver con mas detalles que pasa:
Código:
thaorius@Rhea:/var/www/octopus/public$ wget http://octopus.dev/
--2009-04-06 21:59:20-- http://www.octopus.dev/
Resolving www.octopus.dev... 192.168.3.101
Connecting to www.octopus.dev|192.168.3.101|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.
--2009-04-06 21:59:21-- (try: 2) http://www.octopus.dev/
Connecting to www.octopus.dev|192.168.3.101|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.
--2009-04-06 21:59:23-- (try: 3) http://www.octopus.dev/
Connecting to www.octopus.dev|192.168.3.101|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.
Mi index es lo mas simple posible:
Código PHP:
<?php
// Require Bootstrap.php
require('../application/Bootstrap.php');
// Run application
Bootstrap::run();
Y el bootstrap(view y database setup estan a medias):
Código PHP:
<?php
class Bootstrap
{
public static $front = null;
public static $manager = null;
public static $conn = null;
public static $sett = null;
public static $PROJECT_PATH = null;
public static $APPLICATION_PATH = null;
public static $CONFIG_PATH = null;
public static $MODULES_PATH = null;
public static $MODELS_PATH = null;
public static $LAYOUTS_PATH = null;
const ENVIRONMENT = 'development';
public static function run()
{
// Configure sub-systems
self::prepare();
// Dispatch front controller
$response = self::$front->dispatch();
// Send HTTP response
self::sendResponse($response);
}
public static function prepare()
{
// Setup environment
self::setupEnvironment();
// Require Zend_Loader
require_once('Zend/Loader.php');
// Register autoloader
Zend_Loader::registerAutoload();
// Load core settings
self::$sett = new Zend_Config_Xml(self::$CONFIG_PATH . DIRECTORY_SEPARATOR . 'core.xml', self::ENVIRONMENT);
Zend_Registry::set('CoreConfig', self::$sett);
// Setup default Content-Type
Zend_Registry::set('ContentType', 'text/html');
Zend_Registry::set('ContentTypeCharset', 'UTF-8');
Zend_Registry::set('ContentTypeNoCharset', false);
// Setup front controller
self::setupFrontController();
// Setup router
self::setupRouter();
// Setup view
self::setupView();
// Setup database
self::setupDatabase();
// Register plugins
self::registerPlugins();
}
public static function setupEnvironment()
{
// Re-configure PHP core
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
ini_set('mbstring.internal_encoding', 'UTF-8');
// Set path constants
self::$PROJECT_PATH = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..');
self::$APPLICATION_PATH = self::$PROJECT_PATH . DIRECTORY_SEPARATOR . 'application';
self::$CONFIG_PATH = self::$APPLICATION_PATH . DIRECTORY_SEPARATOR . 'config';
self::$MODULES_PATH = self::$APPLICATION_PATH . DIRECTORY_SEPARATOR . 'modules';
self::$MODELS_PATH = self::$APPLICATION_PATH . DIRECTORY_SEPARATOR . 'models';
self::$LAYOUTS_PATH = self::$APPLICATION_PATH . DIRECTORY_SEPARATOR . 'layouts';
// Update include path
set_include_path(
self::$PROJECT_PATH . DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
. self::$MODELS_PATH . PATH_SEPARATOR
. self::$MODELS_PATH . DIRECTORY_SEPARATOR . 'generated' . PATH_SEPARATOR
. get_include_path()
);
}
public static function setupFrontController()
{
// Get front controller instance
self::$front = Zend_Controller_Front::getInstance();
// Catch HTTP response
self::$front->returnResponse(true);
// Setup module directory
self::$front->addModuleDirectory(self::$MODULES_PATH);
// Setup default module
self::$front->setParam('prefixDefaultModule', true);
self::$front->getDispatcher()->setDefaultModule('front');
}
public static function setupRouter()
{
// Setup new routes
$router = self::$front->getRouter();
$router->removeDefaultRoutes();
$router->addConfig(self::$sett, 'routes');
// Setup router
self::$front->setRouter($router);
}
public static function setupView()
{
// Setup layout
Zend_Layout::StartMvc();
$layoutMvc = Zend_Layout::getMvcInstance();
$layoutMvc->setLayoutPath(self::$LAYOUTS_PATH);
$layoutMvc->setLayout('default');
$layoutMvc->getInflector()->setTarget(':script/layout.:suffix');
// Setup view
$view = $layoutMvc->getView();
$view->addScriptPath(self::$LAYOUTS_PATH . DIRECTORY_SEPARATOR . 'default');
$view->setEncoding('UTF-8');
Zend_Dojo::enableView($view);
}
public static function setupDatabase()
{
// Get Doctrine_Manager instance
self::$manager = Doctrine_Manager::getInstance();
// Enable UTF-8 support
self::$manager->setCharset(self::$sett->database->charset);
self::$manager->setCollate(self::$sett->database->collate);
// Setup Doctrine connection
self::$conn = self::$manager->connection(self::$sett->database->dsn);
}
public static function registerPlugins()
{
}
public static function sendResponse(Zend_Controller_Response_Http $response)
{
// Mount Content-Type header
$header = Zend_Registry::get('ContentType') . (Zend_Registry::get('ContentTypeNoCharset') ? '' : ('; charset=' . Zend_Registry::get('ContentTypeCharset')));
// Set charset to UTF-8
$response->setHeader('Content-Type', $header, true);
// Send HTTP response
$response->sendResponse();
}
}
Cabe destacar que el servidor esta funcionando bien y que los archivos estan siendo ejecutados por PHP al acceder via browser ya que si muestra parse errors y otros errores compile-time.
Un saludo y gracias de antemano.