MAPBENDER installtion fail - php

I have been trying to install Mapbender for several days but in the end I have either this message or the other
http://localhost/mapbender/app_dev.php/manager/applications
Not Found
The requested URL was not found on this server.
Apache/2.4.41 (Ubuntu) Server at localhost Port 80
OR
<?php
use Symfony\Component\HttpFoundation\Request;
$loader = require_once(__DIR__ . '/../app/autoload.php');
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Related

Exception Class request does not exists in index.php

i have uploaded my laravel project to live server but its not working when i track code i get the execption that class request does not exists,please help me to find out the error
this is my file
index.php
<?php
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$app->bind('path.public', function() {
return __DIR__;
});
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
try{
$request = App\Http\Request::capture()
}
catch(Exception $e)
{
echo "error:".$e->getMessage()."<br>";
}
$response = $kernel->handle(
$request = App\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
Request facade usually lives in a different namespace. Try replacing any reference to
App\Http\Request
with just
Request
in order to access the facade by its global namespace alias.

How to access contract references in lumen?

I'm new to Laravel and Lumen. But I have a laravel app to convert in to lumen. This is my index.php in laravel
$app = require_once DIR.'/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle( $request = Illuminate\Http\Request::capture() );
$response->send();
$kernel->terminate($request, $response);
how can i convert this part to lumen? Could you please help me to solve this problem?

Get headers from Symfony\Component\HttpFoundation\Response

For debugging purposes I want to log all headers from the response object like so in filters.php:
App::after(function($request, $response) {
if(App::environment() !== 'dev') { return; }
error_log(print_r($response->getHeadersPleaaase()));
$response is typically a Illuminate\Http\JsonResponse and I cannot find any obvious method for getting the headers there.
Headers is a public property:
error_log(print_r($response->headers));
ini_set("log_errors", 1);
ini_set("error_log", __DIR__.'/../app/logs/prod.log');//ini_set("error_log", your path and file);
error_log( 'BEGIN===========>' );
error_log( $request );
error_log( $response );
error_log( '<========END' );
an example of using (Symfony2)
app.php
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
/*
$apcLoader = new ApcClassLoader('sf2', $loader);
$loader->unregister();
$apcLoader->register(true);
*/
require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
ini_set("log_errors", 1);
ini_set("error_log", __DIR__.'/../app/logs/prod.log');
error_log( 'BEGIN===========>' );
error_log( $request );
error_log( $response );
error_log( '<========END' );
$response->send();
$kernel->terminate($request, $response);

Symfony2 multiple Environments

I was wondering if there is any possibility to define multiple environments in Symfony's app.php?
src/web/app.php:
$kernel = new AppKernel('benchmark', false);
$kernel = new AppKernel('benchmark,dev', false); // < Incl. the dev tools
Why do I ask? Isn't this a stupid question? Because the default check syntax seems to support multiple environments in_array() or do I misinterpret something here?
src/app/AppKernel.php:
if (in_array($this->getEnvironment(), array('dev'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
...
}
The "check" in the app/AppKernel is here to check if there are some bundles you want available in several environments, such as "test" or "dev" for example.
you could then have in your AppKernel following lines :
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new My\Bundle\Uber\MyUberBundle();
...
}
that will enable this example bundle in both dev and test environments.
So the app.php doesn't support multiple environment definitions. If you want several envs you can still define new files as app.php and app_dev.php :)
For example an admin.php with itself look something like
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('admin', false);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

How should the app.php looks like for APC and Symfony 2.1

I would like to preapare the app.php file with Symfony 2.1 and APC. I took the Symfony standard edition configured it with doctrine and then made changes described here:
http://symfony.com/doc/2.1/book/performance.html
<?php
require_once __DIR__.'\..\vendor\symfony\symfony\src\Symfony\Component\ClassLoader\UniversalClassLoader.php';
require_once __DIR__.'\..\vendor\symfony\symfony\src\Symfony\Component\ClassLoader\ApcUniversalClassLoader.php';
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = new ApcClassLoader('sf2', $loader);
$loader->register(true);
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
?>
but it is not working, I got error:
Fatal error: Class 'Symfony\Component\HttpKernel\Kernel' not found in __my_path__\app\AppKernel.php on line 7
How should I prepare the app.php for best performance.
Take a look at the default app.php file in the Symfony Standard Distribution. In order to enable APC your app.php file should look like this:
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
$loader = new ApcClassLoader('sf2', $loader);
$loader->register(true);
require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
You can also improve performance if you enable the symfony gateway cache by uncommenting the require_once __DIR__.'/../app/AppCache.php'; and $kernel = new AppCache($kernel); lines.

Categories