what to do after deploying laravel project? - laravel

I just uploaded my laravel project to my shared hosting and was wondering what things and changes to configuration should I make to make the project work?

My typical checklist:
Modify the document root to the /public folder
Make the /storage and bootstrap/cache folders writeable.
Set up the database
Modify the .env file to suit the live environment
Run php artisan migrate
This should get you up and running, or at least bring you to a point where the errors are detailed enough to work things out

Related

Setting up proper permissions for laravel app in ubuntu

I have a DigitalOcean VPS with ubuntu, I'm fairly new to web apps deployng and I'd like some advice on what would be the best way to properly set permissions on my laravel app folder so I don't have to worry about getting permissions errors.
I know about storage and cache folders and how I should give www-data read and write permissions but is there an easy way to set up all this nicely so I don't have to be changing permissions each time a new folder, file is added?
What does your initial setup looks like after say, cloning a git repository into the /var/www folder of your LEMP stack.
I know there are lots of tutorials on this but I'd like to know the more future-proof, solid way to handle this.
Thanks in advance and I'm open to all advice.

Laravel 5.5 session files don't store in storage/framework/sessions in production server

I am currently maintaining a Laravel 5.5 project.
I have a copy from the production that runs on my own computer. Both of the session drivers I use are File.
Recently, I found that the production started unable to save/store any file in the storage/framework/sessions folder.
However, no matter how I change the permission of all the folders inside storage folder to 777, session files just don't appear in the storage/framework/sessions folder, while the copy that runs on my own computer just writes files as usual.
I can't figure out how the problems would be, even search every information I could find, the problem still can't be solved.
Also, I'm not sure what information that is helpful for others to inspect. The only one that might be helpful maybe the host I use of the production is Hostgator.
Oh, I found the problem was at the .env file, the one in the production was modified by someone or occasionally to use cookie as its session driver.
I've neglected this part, while config/session.php didn't have any differences between the two environments.
After I set the session driver into file and ran php artisan config:cache, everything started performing correctly.

Laravel 5.4 Error 500 on all but Front Page

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.
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.
Make sure that your web-server has read and write permissions to the following folders
public
bootstrap/cache
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
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:
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.
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.
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.
Now you should be able to see Laravel's pages and only public and storage might want different permissions than the rest.
.env file should be created with right permissions as well, if no, you won't key:generate later for instance.

Symfony 3 permissions var/cache

I am setting up Symfony 3 for a web project. I have installed it as per the SymfonyBook. When I test by accessing config.php in the web folder from the browser I get the following messages:
Major problems have been detected and must be fixed before continuing:
- Change the permissions of either "app/cache/" or "var/cache/" directory so that the web server can write into it.
- Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.
I have already set up the permissions as described in the Symfony Book using setfacl and checked them www-data is the group owner of var folder and the cache, logs and sessions sub folders and the folder and file permissions are set to 775.
Please note this is Symfony 3 file structure not Symfony 2.
has anyone had a similar experience and managed to find a solution?
olved the problem. I had set the permissions in the project directory but I have set it up using PHPStorm to copy the files to a local server and I had not changed the permissions on the server. Apologies first time I has used this feature in PHPStorm as i usually work in the served directory.

How to modify laravel view file names

after using artisan make:auth, laravel creates views in storage/framework/views using scrambled file names. I suspect the filenames are created using the app key. Now the problem is that when I port this to the integration server, artisan uses different file names for those views, and seems to create new files with those new names.
How can I tell laravel to use the views that artisan created on my dev machine, even on the staging environment.
For troubleshooting I changed the app key on integration to be the same as my dev machine, but a) it didn't take care of the problem, and b) I'm sure that's not the intent.
Any help is very greatly appreciate
Files stored in storage/framework/views are cached views and basically there's no need to touch them directly.

Resources