function doBootstrap() { $container = getContainer(); // bootstrap PSX\Bootstrap::setupEnvironment($container->get('config')); // check whether http server is available $server = false; try { $config = $container->get('config'); $http = $container->get('http'); $request = new PSX\Http\GetRequest($config['psx_url'] . '/'); $response = $http->request($request); $body = $response->getBody(); if ($response->getCode() == 200 && !empty($body) && strpos($body, 'http-equiv="X-XRDS-Location"') !== false) { echo 'Found webserver and amun instance at ' . $config['psx_url'] . "\n"; $server = true; } else { echo 'Webserver not running or amun instance not available at ' . $config['psx_url'] . "\n"; echo $body . "\n"; } } catch (\Exception $e) { echo 'Webserver not running: ' . $e->getMessage() . "\n"; } define('HTTP_SERVER', $server); }
<?php /* * psx * A object oriented and modular based PHP framework for developing * dynamic web applications. For the current version and informations * visit <http://phpsx.org> * * Copyright (c) 2010-2014 Christoph Kappestein <*****@*****.**> * * This file is part of psx. psx is free software: you can * redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or any later version. * * psx is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with psx. If not, see <http://www.gnu.org/licenses/>. */ require_once __DIR__ . '/../vendor/autoload.php'; $container = (require_once __DIR__ . '/../container.php'); PSX\Bootstrap::setupEnvironment($container->get('config')); $request = $container->get('request_factory')->createRequest(); $response = $container->get('response_factory')->createResponse(); $container->get('dispatch')->route($request, $response);