1

I have a functioning laravel app that I developed locally. I moved it onto a server via ftp (just to show someone for feedback).

I changed the APP_URL in .env to the subdomain pointing to the /public folder. Also changed the database information. Everything else was left exactly as is.

I can access the front page without any problem. Anything else (e.g. /login or an AJAX to any other controller) results in a Server Error 500 that leaves no trace in the server error logs.

When I assign different routes to the / those are also displayed. I can show pages that pull data from the database, so that is not the issue.

Both local development and server run apache on linux.

Any pointers?

Update: Thank you for the suggestions so far. I currently cannot access the server via ssh (not my server). I'm working on getting that set up and will try your solutions as soon as I can.

asto
  • 197
  • 2
  • 17
  • Make sure permissions are right and you run `composer install` on the project root. – Troyer Mar 28 '17 at 12:46
  • There's how to set up permisions_ http://stackoverflow.com/questions/31543175/getting-a-500-internal-server-error-on-laravel-5-ubuntu-14-04 – Troyer Mar 28 '17 at 12:50
  • 1
    Why would I have to run composer if everything has already been set up on my machine before transfering it over? Having trouble installing composer via ssh right now – asto Mar 28 '17 at 16:01

3 Answers3

3

Thanks everyone.

With a little help from the hosting company we found the problem. All we had to was to add

RewriteBase /

to the .htaccess automatically created by laravel.

asto
  • 197
  • 2
  • 17
0

Make sure that your web-server has read and write permissions to the following folders

  1. public
  2. bootstrap/cache
  3. storage If the web-server does not have these permissions it cannot compile views, store session data, write to log files or store uploaded files.

Set Webserver as owner:

assuming www-data is your webserver user.

sudo chown -R www-data:www-data /path/to/directory
  • Don't have SSH access right now. I did however use the server backend to just set chmod to 777 recursively on those three folders. Terrible idea security wise, I know, but just for testing anyways. Sadly nothing changed. still getting the 500. – asto Mar 28 '17 at 15:08
0

Not always will work if you CHOWN it, in some cases I had to CHGRP to www-data on my Ubuntu VPS as well.

How I'm checking is this:

  1. Domain has to point and if there's an SSL, a padlock in the web browser has to be seen. No matter on your localhost, but Laragon is the quickest to set it up.
  2. Now I know that I see what I should if I can write something in my index.html file inside. If I can't see it, permissions or roles are wrongly set.
  3. Laravel has tons of info online (or google it) on how to set up CHOWN and CHGRP, so, if I'll clone some repo, or unzip it, the first thing now is to set these two up. If these two are rightly done, I can do npm install, composer install - if it's not a shared hosting where I can't do it, but VPS or localhost.
  4. Now you should be able to see Laravel's pages and only public and storage might want different permissions than the rest.
  5. .env file should be created with right permissions as well, if no, you won't key:generate later for instance.