I am taking the "Laravel 5.4 From Scratch' course on Laracasts. I created two projects and everything was working well, but I realized that the server stopped showing me debug errors. It now throws the generic 'Sorry, page could not be found' error in BOTH applications (completely separate from each other), I run them with php artisan serve.
Laravel is ignoring the APP_DEBUG=true and APP_ENV=local in .env file.
In config/app.php:
'env' => env('APP_ENV', 'local');
'debug' => env('APP_DEBUG', true);
The application doesn't show debug, just some regular simple 'this page can not be found' errors.
I've tried:
rebooting the server
php artisan config:clear
php artisan optimize
php artisan cache:clear
nothing works, the environment is still production-like, doesn't display any errors.
How to turn on debugging?
UPDATE: php artisan env returns local but on the browser-side nothing changes, still generic user-friendly error pages. I tried on different browsers and clearing browser cache, nothing works.
The error you mention is a 404, not an error when the app fails, so the error has not much to say.
Try writting some breaking code to see the detailed debugging error
If both apps started to show that error in well-known routes you had working before, maybe you modified something that breaked all the routes and you cannot match any of them.
Related
I have a site which I've converted to Symfony 6.1 starting from a blank site and copying stuff over from the previous 3.4 site. In dev, everything works perfectly.
Today, I've tried to make it live. I deleted all previous content, cloned my repo and updated to latest version. I created a .env.prod.local file and set the APP_ENV variable to prod from dev.
Symfony is simply not detecting the change of environment. In my folder I have the .env file which is the default, I have not made any changes in that file. In my dev environment, I have .env.dev.local, I changed this to .env.prod.local in my production environment and updated the DB connection string and APP_ENV variable. The resulting errors showed that the env vars were not being picked up. After some research, I ran composer dump-env prod and that produced a .env.local.php file with the same vars as .env.prod.local. However, if I run bin/console debug:container --env-vars it says No environment variables are being used.. If I edit the .env.local.php file and change APP_ENV from 'prod' to 'dev', save and close, and run bin/console debug:container --env-vars again, then I see the vars I am expecting to see.
I cannot run my site in dev mode since it shows the development profiler and this cannot be visible. I cannot run the site in prod since it fails to pickup the vars from the .env.local.php file sometimes - some pages work while others throw a 500 internal server error. On the pages that throw a 500 error, if I change APP_ENV back to dev and load the page again, there is no error and no problems shown in the profiler. I have no information about what the error is in prod mode, I just see a generic error message and there are no logs or error messages on the server that I can find.
I'm running on Apache 2.4 and PHP 8.1.
Any help appreciated!!
After some random and desperate testing, I changed the APP_ENV var to 'live', and this allowed me to see the full error message (instead of a generic 500 internal server error message), and that message showed me that I was missing a /config/services_prod.yaml file. I created this file and cleared the cache, and no more error! Also, setting APP_ENV to live does not show the profiler bar, which was better than setting APP_ENV to dev in an actual production environment and having end users seeing the profiler bar...
All in all a massive PITA, setting this site live should have been an easy process and it's ended up costing me 4 hours just because of having no idea what Symfony is doing with environment variables (despite reading the docs like 5 times). I still don't understand why running bin/console debug:container --env-vars with APP_ENV as prod shows No environment variables are being used., while setting APP_ENV to dev or live and running bin/console debug:container --env-vars shows the expected vars. Seems to be a problem with Symfony?
This route was working for months but suddenly it went blank and I got no errors and logs for it. I tried cleaning the cache using "php artisan optimize:clear" and cleared all the possible caches, but it doesn't work!
I haven't had any changes related to this route and view. It seems like a bug. My Laravel version is 7.30.4.
And I'm sure it's a route-related issue because changes in view don't affect it.
Yo should put some debug or code on the Handler.php, just to be sure if there's an Exception. Also change your .env enviorment to not production, don't forget to run a "php artisan optimize". Hope this info helps you.
When my notify code runs when it is supposed to, I am getting the error Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "", with message "" on my Laravel 5.3 production site. When I look at the full stack trace, it seems to be caching old-incorrect login credentials. I have checked and double checked the updated 'config/mail.php' file and the .env file. The stack trace is showing "Swift_Transport_Esmtp_Auth_LoginAuthenticator->authenticate(object(Swift_SmtpTransport" with totally outdated credentials that are different from the afore mentioned updated files. I have run "sudo systemctl restart nginx" and "php artisan cache:clear" with no change. Can someone tell me how to address this error message more effectively? Is there a different file I need to update? or setting? Everything works fine on my dev machine using mailtrap.
See Laravel 5.3 > Configuration Caching
You should typically run the php artisan config:cache command as part of your production deployment routine.
Run php artisan config:cache and restart your server. This will scrap loaded/cached configuration files data.
I'm learning how to build a blog using Laravel and following along on these youtube tutorials: https://www.youtube.com/watch?v=R8B4og-BeCk
I made a mistake in tutorial part 13 locally which I didn't know how to fix, but I had the project up on Github so I decided to use an older version which I knew had worked perfectly after finishing tutorial number 12. I then purposely deleted the entire broken project locally, and downloaded the zip from Github and simply copy pasted the entire older Github blog commit into the local folder (as suggested here by Sivan: How to get certain commit from GitHub project)
But when I went to test the site on my browser by running "php artisan serve" in the terminal as normal (I'm using Ubuntu as my os) it came back with the same error as here Laravel 5 Failed opening required bootstrap/../vendor/autoload.php .
I followed the advice of Shubhamoy Chakrabarty and ran "composer update --no-scripts", and it then seemed to be working.
So I ran "php artisan serve" once again in the terminal and the response in the terminal appears positive as it comes back with the usual:
Laravel development server started on http://localhost:8000/
[Sun Jul 10 13:55:19 2016] 127.0.0.1:58276 [200]: /favicon.ico
But when I go to test the site in the browser, it comes back with the error "Whoops, looks like something went wrong." and the error message "Failed to load resource: the server responded with a status of 500 (Internal Server Error)".
And this is the point I'm at now and wondering if you could help me with. Please feel free to tell me if I went about it wrong at any point and what I should do now as I'm still figuring out the best way to go about this.
Thanks very much in advance!
I am glad you are enjoying the Laravel Series.
There are a few things on here that might help you. First of all, make sure you have ran all of the migrations which might be causing problems if your Database is not in sync with the code. You can do this in the terminal by typing php artisan migrate and running the command.
Also it sounds like your project is not running in development mode. In development mode, Laravel will publish more detailed errors about what is happening, instead of simply a 500 error. This will help us debug the problem.
Remember that on GitHub there are always a few files that do not get sent to the repo that you might need. One of these files is the .env file that contains important information about your project to Laravel. In this file it will tell Laravel to run the project in development mode, which in turn will reveal the detailed error messages.
The default .env file should look like this:
APP_ENV=local
APP_DEBUG=true
APP_KEY=11mw9hJML4VDO3PGrtIFnUaE8hCrXads
DB_HOST=127.0.0.1
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=localhost
REDIS_PASSWORD=null
REDIS_PORT=6379
Of course your app key might be different. It is autogenerated when you build a new app or you can generate it yourself. You can use the one above if you don't have one. Also note that the APP_DEBUG is set to true which will give you those better error messages.
Note also the DB settings. Make sure your database settings work. Check the DB_DATABASE to the name of your database, the DB_USERNAME and DB_PASSWORD also should match the settings of your database.
Try this and see if this works. Also once the database settings are in your .env file then you will want to run php artisan migrate as well.
Let me know if that helps.
I create a symfony 2.3 project. some times all the pages shows 500 error. app.php also shows error. i dont know why can any one help
www.dotcue.in/sandp/web/app.php [HTTP/1.0 500 Internal Server Error 353ms]
I'm going to take a wild stab in the dark here and conclude that it is one of the following problems:
The prod cache is out of date, to fix it run: php app/console --env=prod cache:clear
The vendors are missing, to fix it run: php composer.phar install
If it is a problem when code that you have written however, we need to see the errors.
Overly big HTTP headers (e.x. 4 kB) can cause this error depending on the hosting server. ChromePHP sends all of its data in HTTP headers. (you wrote you use ChromePHP)
Try turning it off or lowering the data sent with ChromePHP. Did it help?