Laravel 5 not creating logs - php

I am getting started with Laravel 5, using Homestead/Vagrant for a server, SSHing in with Putty.
I'm building my first site and it's not creating a log in /storage/logs. Neither is it displaying errors. I've run chmod -777 on the /storage directory, so that's not it. Any ideas?
UPDATE: as suggested, I went into the error.log in vagrant/var/hhvm/. Sure enough, that was it. The error was "\nFatal error: Class undefined: HTML in /home/vagrant/Code/Laravel/storage/framework/views/441aef21be6c3c32079f86e5812a9d0a on line 39".
I followed the steps listed below to add the class. http://laravelcollective.com/docs/5.0/html#installation Edited the composer.json, ran composer update, added the provider and aliases. Still getting the white screen of death.
There is now a log in /storage/, which says:
[2015-05-27 11:33:44] local.ERROR: exception 'InvalidArgumentException' with message 'Command "tail" is not defined.' in /home/vagrant/Code/laravel/vendor/symfony/console/Symfony/Component/Console/Application.php:549 , followed by a stack trace. This seems to be the error thrown by my attempt to run laravel tail, which I did before looking in the vagrant log. Nothing in there about why it's not loading now.

As FBidu answered very good answer,but artisan tail is not come with default package in laravel 5. However can be installed with
composer require spatie/laravel-tail
In config/app.php
'providers' => [
...
'Spatie\Tail\TailServiceProvider',
...
];
After that’s done you can tail your local log with
php artisan tail
The remote log can be tailed with
php artisan tail production
Link here

First of all, you have to do an chmod -R 777 on storage to guarantee that all of the files and folders within storage are writeable.
Secondly, it would be nice to allow the debug mode!
You can also try to run artisan tail to get the latest logs

Related

Laravel 500 error no logs

First of all, according to stackoverflow, this problem occurs when something is wrong with permissions of bootstrap/cache and storage directories. And I tried literally every advice on that with no luck.
I was happy user of Xubuntu 16.04 at my old laptop, developed one project. Using docker-compose to set up development environment. Yesterday I bought brand new PC, installed Kubuntu 18.04, installed docker and everything I need to work.
Cloned repository, ran composer install, docker-compose up, then php artisan migrate and php artisan storage:link. But when I try to open website in browser, I get 500 error with empty body response.
APP_DEBUG is set to true.
6 hours later I'm here with literally zero results. Tried dozens of solutions found here and on forums (just example).
I even did a little experiment: removed project directory from my old laptop, cloned it from scratch, installed everything required and it worked. Without any permission problem.
And what kills me more: there are no logs inside docker containers, no logs inside laravel directory, just nothing.
Please help! What's wrong? Maybe it's Kubuntu? Maybe it's 18.04? Maybe it's newer docker version?
P.S. Right now bootstrap/cache and storage directories are owned by alex:alex and has 775 permissions. Exactly same as at my laptop.
Add a dd($exception->getMessage()); to the exception handler class right before line 37. Run the request and check the response.
If that doesn't avail anything, verify the request is hitting the webserver by checking access and error logs. Check system logs also using dmesg and similar.
Since you mention Docker, if you're using nginx, be sure your site configuration is not being overwritten when running docker-compose up.
Looks like error is probably either related with storage permissions that should be 777, or with ownershp, or with app's bootstrap, before it even runs your files, when it pulls out configuration setup.
Check the .env configuration, and config files in config directory for any errors.
For storage switch to 777 permissions
chmod -R 777 storage
For configuration issues, try first with
php artisan config:clear
From the console.
If you are on linux server it may be selinux permissions.
Try setting selinux as passive:
in terminal type:
setenforce 0
then see if you see errors. If it works as should you want to turn selinux back on:
setenforce 1
Then give directory writable with selinux command:
chcon -R -t httpd_sys_rw_content_t /path

Symfony 4.1 cache not being created

I've recently upgraded Symfony to the new Symfony4.1. As seen over here we no longer need to setup file permissions anymore. I ran the command:
php bin/console cache:warmup
And no errors came while running that. However when I try and view the website. I get the following error.
Uncaught RuntimeException: Unable to write in the cache directory (/var/www/mywebsite.com/var/cache/prod)\n in /var/www/mywebsite.com/var/bootstrap.php.cache
Obviously this means that the new feature of Symfony4.1 is not working for me. Any idea what might be causing this?
Give permissions to cache directory with bash command:
sudo chmod -R a+rw /path/to/cache_directory/

Laravel project not working after successfully installation on the server

I have successfully installed Laravel project on the server but its not working. I am getting error like "page isn’t working
HTTP ERROR 500".
I have execute command
composer create-project --prefer-dist laravel/laravel
and created a directory name Laravel. But it's not working while same thing I have done on my local server and it's working fine.
in local you serve laravel project by internal web server using below command:
php artisan serve
but in your server env you must use apache conf and you must set document root like this:
your_project_directory/public/index.php
if every thing ok till now, your error must made by laravel error handling.
if so, then you can check your laravel log to find out exactly 500 error reason:
go to your project directory, then navigate to storage directory, here is logs directory and it has a laravel.log
tail -f your_project_directory/storage/logs/laravel.log
your generated log are here so read and solve it :)
tips: you must set privilages to your storage directory in server.
I run composer update and it resolve the problem. Known I run the following command from the root path of the application:
It was not the .htaccess file that was the problem nor the index.php. The problem was on accessing the files and requiring permissions.
For solving the problem i ran the following commands through terminal.
sudo chmod 755 -R laravel_blog
and then type below to allow laravel to write file to storage folder
chmod -R o+w laravel_blog/storage
This two commands solved the problem.
Please insert below command and try to access.
setenforce 0
it's working for me.

Laravel Project not working in XAMPP htdocs folder.What could be the reason of this?

Error States:
The localhost page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500
my project is in htdocs>laravel>project1>public>index.php
any more details like installation etc?
how did you install the laravel project by php artisan command or by composer or by zip package? and why you want to run your laravel project with the xammp file structure.. you can simply write the "php artisan serve" in your command line.. also make sure the .env variables set properly.. also try to clear all cache browser and run following query and try again
php artisan cache:clear
you need to know that the default port of laravel project is localhost:8000
When you meet 500 error, it's usually permissions related problem. Set write permissions on a storage directory. For Linux:
sudo chmod -R 775 storage
If it didn't help, look into Laravel error log.

New Laravel Project Throwing 500 Error: require(): Failed opening required autoload.php

I trying to learn laravel and I am attempting to set it up on my server.
I have meticulously followed all the instructions in this tutorial while changing some variables based on the names of my own directories:
http://davidmyers.name/post/laravel-on-digital-ocean
The 500 error only is thrown when I visit the laravel project's public folder. When I attempt to visit any other page such as PHPMyAdmin or any other PHP or HTML page, the page pulls up just fine.
Is there anything I could be missing that is not included in the tutorial that I referenced? I double checked that I am following all the steps correctly.
Also, running composer update in the directory throws this error:
[RuntimeException]
Error Output: PHP Warning: require(/var/www/html/testproj/bootstrap/../vendor/autoload.php): failed to open stream: No
such file or directory in /var/www/html/testproj/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/var/www/html/testproj/bootstrap/../vendor/autoload.php' (include
_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/testproj/bootstrap/autoload.php on line 17
I found this related stackoverflow article:
Laravel 5 Failed opening required bootstrap/../vendor/autoload.php
but the solution did not work for me, since my phpinfo() shows that OpenSSL is enabled.
The problem is that the server does not have access to those locations.
Run the following commands
sudo chmod 755 -R "your project name"
and then
chmod -R o+w "your project name" /storage
if it still doesn't work try running:
sudo chmod 775-R "your project name"
sudo chmod 775-R "your project name"/storage
or
sudo chmod 777-R "your project name"
sudo chmod 777-R "your project name"/storage
Have you run composer install ? This should automatically run php artisan optimize after install, which I believe is the command to create the file in question.
You must install dependencies by composer using:
composer install
and then give right permission to storage directory:
chmod 777 -R storage
or
sudo chmod 777 -R storage
It turns out that I was doing everything right, but when I went to run composer install I didn't see that it was throwing an installation error due to my server not having enough memory. Increasing my server's memory fixed the problem.
There are 2 things to consider,
1. Web server throwing 500 error (as if text and font were from Chrome) or
2. The application is showing 500 error (with beautiful image and text)
Case 1: you probably need to install composer
sudo composer install
Case 2: Check appropriate permission on storage/ (as suggested on other answers) and check if you have .env file. if not copy .env.example and rename to .env and you also need to generate application key.
sudo php artisan key:generate
PS: You may be in this situation mostly if you have used git to deploy your code on server and your development machine is different. This answer is based on the scenario which I faced and how it was solved.

Categories