# Problem with filemanager and  $kernel-\>boot();

**URL:** <https://forum.mautic.org/t/problem-with-filemanager-and-kernel-boot/7716>\
**Category:** Product Support\
**Created:** [February 28, 2017, 12:31pm UTC](https://forum.mautic.org/t/problem-with-filemanager-and-kernel-boot/7716 "2017-02-28T12:31:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLazyWebdev](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@TheLazyWebdev](https://forum.mautic.org/u/TheLazyWebdev)\
**Post date:** [February 28, 2017, 12:31pm UTC](https://forum.mautic.org/t/problem-with-filemanager-and-kernel-boot/7716/1 "2017-02-28T12:31:24Z")

</div>

Following a server migration and shortly after a move to https, I am having trouble getting the filemanager to work correctly. The rest of the admin seems to be working just fine. A colleague says that it was working before the move to https but I am not entirely certain of that but it might be of some help.  
  
  
  
When accessing the file manager it says “You are not authorized to use filemanager.”  
  
  
  
I have looked at the called script:  
  
https://[[mydomain.com](http://mydomain.com)]/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/filemanager.php?path=%2F&mode=getfolder&showThumbs=true&time=557&type=Images  
  
  
  
which returns: {“Error”:“You are not authorized to use filemanager.”,“Code”:"-1",“Properties”:{“Date Created”:null,“Date Modified”:null,“Height”:null,“Width”:null,“Size”:null}}  
  
  
  
However, with some analysis I see that the problem occurs because the try-catch fails in the connectors/php/user.config.php file, specifically at the point of  
  
  
  
$kernel-\>boot();  
  
  
  
If I do a a die(“KIA”) before that point we get there. After and the page errors before the die().  
  
  
  
I have taken the latest code from github.

Code:

\<?php /\* ... \*/ use SymfonyComponentHttpFoundationRequest; use SymfonyComponentHttpKernelEventGetResponseEvent; use SymfonyComponentHttpKernelHttpKernelInterface; use SymfonyComponentHttpKernelKernelEvents; use SymfonyComponentSecurityCoreAuthenticationTokenTokenInterface; // Boot Symfony try { require\_once \_\_DIR\_\_.'/../../../../../../../../../autoload.php'; require\_once \_\_DIR\_\_.'/../../../../../../../../../bootstrap.php.cache'; require\_once \_\_DIR\_\_.'/../../../../../../../../../AppKernel.php'; MauticCoreBundleErrorHandlerErrorHandler::register('prod'); $kernel = new AppKernel('prod', false);

```
$kernel->boot(); // <--------------- ERROR HAPPENS AT THIS POINT

$container = $kernel->getContainer();
$request = Request::createFromGlobals();
$container->enterScope('request');
$container->set('request', $request, 'request');
// Dispatch REQUEST event to setup authentication
$httpKernel = $container->get('http_kernel');
$event = new GetResponseEvent($httpKernel, $request, HttpKernelInterface::MASTER_REQUEST);
$container->get('event_dispatcher')->dispatch(KernelEvents::REQUEST, $event);
$session = $container->get('session');
$securityToken = $container->get('security.token_storage');
$token = $securityToken->getToken();
$authenticated = ($token instanceof TokenInterface) ? count($token->getRoles()) : false;

```

} catch (Exception $exception) {  
error\_log($exception);  
$authenticated = false;  
}

//...  
?\>  
  
I am web developer but have never used mautic or symfony before so could so with some pointers. Any help would be appreciated - been struggling with this for a while. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![TheLazyWebdev](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@TheLazyWebdev](https://forum.mautic.org/u/TheLazyWebdev)\
**Post date:** [February 28, 2017, 12:31pm UTC](https://forum.mautic.org/t/problem-with-filemanager-and-kernel-boot/7716/2 "2017-02-28T12:31:25Z")

</div>

Following a server migration and shortly after a move to https, I am having trouble getting the filemanager to work correctly. The rest of the admin seems to be working just fine. A colleague says that it was working before the move to https but I am not entirely certain of that but it might be of some help.

When accessing the file manager it says “You are not authorized to use filemanager.”

I have looked at the called script:  
https://[[mydomain.com](http://mydomain.com)]/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/filemanager.php?path=%2F&mode=getfolder&showThumbs=true&time=557&type=Images

which returns: {“Error”:“You are not authorized to use filemanager.”,“Code”:"-1",“Properties”:{“Date Created”:null,“Date Modified”:null,“Height”:null,“Width”:null,“Size”:null}}

However, with some analysis I see that the problem occurs because the try-catch fails in the connectors/php/user.config.php file, specifically at the point of

$kernel-\>boot();

If I do a a die(“KIA”) before that point we get there. After and the page errors before the die().

I have taken the latest code from github.

[code]\<?php  
/\*  
…  
\*/  
use SymfonyComponentHttpFoundationRequest;  
use SymfonyComponentHttpKernelEventGetResponseEvent;  
use SymfonyComponentHttpKernelHttpKernelInterface;  
use SymfonyComponentHttpKernelKernelEvents;  
use SymfonyComponentSecurityCoreAuthenticationTokenTokenInterface;  
// Boot Symfony  
try {  
require\_once **DIR**.’/…/…/…/…/…/…/…/…/…/autoload.php’;  
require\_once **DIR**.’/…/…/…/…/…/…/…/…/…/bootstrap.php.cache’;  
require\_once **DIR**.’/…/…/…/…/…/…/…/…/…/AppKernel.php’;  
MauticCoreBundleErrorHandlerErrorHandler::register(‘prod’);  
$kernel = new AppKernel(‘prod’, false);

```
$kernel->boot(); // <--------------- ERROR HAPPENS AT THIS POINT

$container = $kernel->getContainer();
$request = Request::createFromGlobals();
$container->enterScope('request');
$container->set('request', $request, 'request');
// Dispatch REQUEST event to setup authentication
$httpKernel = $container->get('http_kernel');
$event = new GetResponseEvent($httpKernel, $request, HttpKernelInterface::MASTER_REQUEST);
$container->get('event_dispatcher')->dispatch(KernelEvents::REQUEST, $event);
$session = $container->get('session');
$securityToken = $container->get('security.token_storage');
$token = $securityToken->getToken();
$authenticated = ($token instanceof TokenInterface) ? count($token->getRoles()) : false;

```

} catch (Exception $exception) {  
error\_log($exception);  
$authenticated = false;  
}[/code]  
//…  
?\>

I am web developer but have never used mautic or symfony before so could so with some pointers. Any help would be appreciated - been struggling with this for a while. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![TheLazyWebdev](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@TheLazyWebdev](https://forum.mautic.org/u/TheLazyWebdev)\
**Post date:** [February 28, 2017, 12:58pm UTC](https://forum.mautic.org/t/problem-with-filemanager-and-kernel-boot/7716/3 "2017-02-28T12:58:54Z")

</div>

Oh I have done this by the way:

Edit:  
etc/php.ini

Add:  
extension=pdo.so  
date.timezone=“America/New\_York”

pdo.so was already enabled. The date.timezones matches that set on the server.

---

<div class="post-metadata">

**Author:** ![TheLazyWebdev](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@TheLazyWebdev](https://forum.mautic.org/u/TheLazyWebdev)\
**Post date:** [February 28, 2017, 1:10pm UTC](https://forum.mautic.org/t/problem-with-filemanager-and-kernel-boot/7716/4 "2017-02-28T13:10:33Z")

</div>

Looking into the AppKernel.php boot() function it is here that the error occurs:

```
    $registeredPluginBundles = $this->container->getParameter('mautic.plugin.bundles');

    foreach ($this->getBundles() as $name => $bundle) {   
        $bundle->setContainer($this->container);        
        $bundle->boot(); // <------ ERRORS OCCURS HERE IN THIS LOOP
    }

```

I have added an echo to the $name in the loop and found it dies on the MauticCitrixBundle. The new server is a centos 7 server.

When the main mautic app starts it gets through all the plugins ok, however, when in the scope of the filemananger it bombs at the citrix plugin. Might this be a pathing issue?

---

<div class="post-metadata">

**Author:** ![TheLazyWebdev](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@TheLazyWebdev](https://forum.mautic.org/u/TheLazyWebdev)\
**Post date:** [February 28, 2017, 4:10pm UTC](https://forum.mautic.org/t/problem-with-filemanager-and-kernel-boot/7716/5 "2017-02-28T16:10:28Z")

</div>

OK - seems (somehow) the timezone conflict was causing that initial problem as the server timezone reset after a reboot. However the next problem is a “no way” message.

I am checking out the function is\_valid\_path() in the filemanager\_class and have seen that the path being checked is

var/www/html/[mautic]/media/images/

It looks like it really needs a / at the front of that to be valid, but for the life of me I cannot make that happen with the

“serverRoot”: false,  
“fileRoot”: “/”.

or whatever combo I set in the filemanager.config.js file

---

<div class="post-metadata">

**Author:** ![TheLazyWebdev](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@TheLazyWebdev](https://forum.mautic.org/u/TheLazyWebdev)\
**Post date:** [March 1, 2017, 9:37am UTC](https://forum.mautic.org/t/problem-with-filemanager-and-kernel-boot/7716/6 "2017-03-01T09:37:45Z")

</div>

As I could not get it to work with the available configs I added some code into the filemanager.class.php file, getFullPath() function which adds the preceding forward slash if it is missing (and it is on this server): e.g.

if(substr($full\_path,0,4)==“var/”){  
$full\_path = “/”.$full\_path;  
}

This is on Centos, in case this helps anyone else.
