SVG Helper not working on live server

Using the SVG helper to render a logo which works fine locally but not on my VPS (CentOS 7, Apache, PHP 7.2). I’m rendering it with the following…

  $logo = $site->sitelogo()->toFile()->mediaRoot();
  $logoalt = $site->sitelogoalt()->toFile()->mediaRoot();

<?php if(!$page->isHomePage()): ?>
  <a href="<?= $site->url() ?>"><?= svg($logo) ?></a>
<?php else: ?>
  <a href="<?= $site->url() ?>"><?= svg($logoalt) ?></a>
<?php endif ?>

Is there anything wrong there? Does the helper depend on anything special, like php extension that might be missing?

I’ve had strange issues before with case sensitivity, maybe ->mediaRoot() is returning something it doesn’t like. Everything is lowercase though, so i’m not convinced that is the issue. It’s not even rendering the tag, nothing is getting rendered at all, just the anchor tag.

Does the file exist in the media folder?

On a side note:

This sort of code is a no no…

Why? the helper needs a filename & path, but the images are stored in fields, so yes they are in the media folder, they were uploaded through the panel. Whats the better way to do it?

Because I’m preaching this here all the time: never to call an object method (mediaroot()) without checking for the object (the file in this case).

Sure, but i know that :slight_smile: It’s a work in progress, I just haven’t written the check in yet.


So does


return anything then?

yes but can i DM you? I wont want to publicise the site. The dump is returning the right path and file name, but it is a full path from the server root, rather then from the web root. Maybe it doesn’t like that. I guess it cant start outside of the site folder for permissions reasons.


Hm, it shouldn’t be a permissions problem, because PHP should be able to access parts outside the web root (otherwise this whole thing about putting stuff outside the web root wouldn’t work). If you don’t use the helper but do a simple

echo F::read($logo);


Nope… that doesn’t work either.

I just tried getting to the panel too and got this…

The panel assets cannot be installed properly. Please check permissions of your media folder.

But thats another problem.

Maybe not, if the media folder is not readable, then files in the media folder wont be readable.

(And if you use the$file->root() instead of the mediaRoot?)

I’m not sure how to fix that really, the files have the correct user:group etc. My other site does that. I know the media is writable because I exclude it from my rsync, and Kirby is generating images in the media folder, it just cant seem store the panel assets there.

OK… that works! But it gives the same path back in a var dump that mediaroot() gave me… odd.

As for this error, I just jumped on the server and deleted the media folder. Then i hit some pages, and kirby recreated the media folder and stored images in it. However, if i try hit the panel, i get the error above, its refusing to store the panel assets.

I assume this is not the only project on your VPS, right? And all others are working without problems?

My site ( and this site im working are the only K3 sites on the box. To be honest, i work locally and push up, i never work on the panel on the live site, so its not a huge deal. But i kind of feel the need to know why its not working. Both sites do it.

6 posts were split to a new topic: Panel assets not stored in media folder - error