Lime $app->render() returns 500 on live server

Hello. Cockpit is awesome and I’ve rapidly built the website out on a local server and everything works great locally. However, when I went live with the site, any $app->render that calls a template file produces a 500 error on the browser. Renaming the template file so that the $app->render points to a non-existent file results in a blank page. Removing the $app->render() and replacing with a simple return “hello world” works fine too. I’ve tried renaming the folder, moving the template file to the root directory. All permissions are rwx. I feel like it’s something simple. Can anyone please help. Thank you so much. CURIOUSLY, works just fine and I can perform all functions such as adding and removing collections and so on.

Test environment was windows and live environment is ubuntu linux 19.10. Using the sqldriver addon with postgres. Also using betterslugs, apitester. Again, everything works on the test environment.

Thanks again.

  • Ife

It sounds like an permission problem. I moved from Windows to openSUSE recently and I faced the same problem. Windows has no real concept for user and group permissions, so copy/paste in all directions always worked fine. Now $app->render() needs write access to /storage/tmp. Giving public write access with chmod 777 /storage/tmp was a temporary workaround, but disabling write protection isn’t the best idea. Changing the owner to wwwrun:www helped me on SUSE to solve write access for apache2 inside html folders. On Ubuntu the apache user/group should be www-data:www-data.

I’m still struggling with the perfect permissions setup for my new environment, but maybe I could lead you in the right direction.

Thanks so much for your response. I have tried every iteration I could think of what you said. Here are some things discovered.

  • chown www-data:www-data -R on storage did not fix the error.
  • chown www-data:www-data -R on storage consistently produces 500 error after clearing cache in settings.
  • chown www-data:www-data -R on cockpit directory breaks the site after clearing the cache in settings.
  • api access, which had worked, no longer works.
  • all files and directories are 777.

I looked around on similar routing errors with laravel and some people mentioned the rewrite parameters being the issue. Here’s the link I read:

And still getting “hello world” whenever i don’t render with a template.

Is it possible that this might be the case.

Once again, thanks for helping me with this. I’m still mystified as to what’s going.

Can you tell me some more about your setup and your file structure? Do you use symlinks?

So I fixed it. I narrowed the problem a little more and turned on error reporting in php.

Seemed to have been due to me declaring a new instance of a class. Code looked something like this.

$menu = new View\Elements\Menu($this);
echo $menu->view();

Traced it down to an director error. used a \ instead of a /. Sometimes I don’t know whether to love or hate windows.

Thank you very much with your time and assistance. Learned more than I ever thought about stuff I didn’t need to know.

On a sidenote. It is frustrating that php throws a 500 code on an os level error. But I suppose it’s a lesson on always turning on error reporting.

  • Ife

Thanks so much. Figured it out. Wasn’t anything about cockpit. Just discrepancies between the build and test system.

I’m glad, you figured it out. And it’s good to know about a new source for 500 errors.