I had a completely working project on Laravel 5.3, yesterday I upgraded to Laravel 5.4 locally to check all was working and was very happy so put a plan in place to move it live.
Where I have now deployed the site on my forge.laravel.com managed servers, most of the routes work okay but when trying to log out I get the following error:
I'm not quite sure what the issue actually is. This site works totally fine locally. Can anyone point me in the right direction?
As a quick fix (after emailing Taylor) he suggested that I comment out the \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, middleware inside app\Html\Kernal.php
Tried it and it worked perfectly!
Easy fix when you know how! haha
I had something similar issue, I have tried to increase my limits too. You can't do them on ini file in laravel 5.4 but you can add your customizations on public/.htaccess
https://stackoverflow.com/a/42399301/7596103
Related
I'm facing a wired issue with Laravel where routes with multiple parameters (both mandatory/optional) aren't working.
Environment Information
Local: Windows, XAMPP, PHP 7.3
Production: Ubuntu 18.04, PHP 7.4
Initially, I suspected issue with .htaccess file but that seems not to be an issue.
This works perfectly on my Local, but for some reason, that doesn't work on Ubuntu Server.
The following code works perfectly.
Route::any('route/me/','Tst#routeme');
However, any of the following doesn't work:
Route::any('route/me/here/','Tst#routeme');
Route::any('route/me/here/{id?}','Tst#routeme');
Route::any('route/me/here/and/here','Tst#routeme');
Any suggestions where I can look up to fix this out, please?
My first suggestion would be to place the route with most params at the top like:
Route::any('route/me/here/and/here','Tst#routeme');
Route::any('route/me/here/{id?}','Tst#routeme');
Route::any('route/me/here/','Tst#routeme');
It's more like which ever route matches first gets executed first so from top to bottom the least param route matches last.
Second thing i would suggest you to group the routes like:
Route::prefix('route/me')->group(function () {
Route::get('here/and/here', 'Tst#routeme');
Route::get('here/{id?}', 'Tst#routeme');
Route::get('here', 'Tst#routeme');
});
for better readability...
I can't give you specifics on why this particular scenario is happening but, matching your development and production environments should elimate these problems in future.
Homestead Docs
The Homestead vagrant box provided by the Laravel team is a solid choice and well documented. It is an Ubuntu 18.04 / 20.04 machine and can be configured with many add-ons. You can easily configure which version of PHP any given project is using with a single line in the Homestead.yaml file.
Docker Docs
Docker is a little more advanced but very flexible in how it can be configured. It's container design allows you to isolate the dependencies of one project from the next.
These aren't that difficult to setup (easily done within a day or two) and allow you to replicate your production environments almost perfectly.
It will help massively in those "but it works on my machine" moments!
updating my own question so that might be of some help for others.
I would say probably this is the last thing that someone (or at least me) failed to check. I tried to list the routes in my server and found my newly added route was not found.
php artisan route:list
Earlier, I cleared cache, restarted apache but didn't help. Finally found the following commands to be a lifesaver when routes are cache & aren't working.
So the thing that worked for me - clearing the "route" cache.
php artisan route:cache
php artisan route:clear
My hearty thanks to #Spholt,#Akbar khan, #Spholt, #Gzai Kun for helping out.
This happened to me a couple of months ago. It might have happened in the process of a composer update, but I'm far from sure on that one. I've even updated my project to Laravel 5.3 and it still I can not get make:migration to work through Artisan. No the project it updated to 5.4 and it still do not work.
I've checked out this thread and I have the exact same problem. The symptoms were exactly the same, however the OPs solutions did not work for me.
I get no error or result in the terminal when running make:migrate.
I can generate any other file through Artisan it seems.
I tried to create a new model and pass the -m along with it. Didn't work.
I've checked permissions (and even changed migration folder), but didn't
help.
If I create my own migration-file the rest of the process through artisan works fine (migrate, DB-manipulation etc).
I've tried with different terminals and computers.
Since project were upgraded and even reinstalled I fear it has
nothing to do with the deep kernal. However maybe some sort of conflict from the higher level.
And in the last phase of my quest I tried to figure out what user interacting elements that can possibly effect the make:migration. Nothing worked.
I searched the web without any solution, then I gave up on that project and started to make my own migration files. However I now got some new hope when I saw that other thread.
After some troubleshooting I finaly managed to figure out the problem.
I narrowed it down to have something to do with the config/app.php-file.
Seems I in this project had typed in:
'timezone' => 'UTC+2'
This made creation of migration-files come to a halt without error messages. And it effected only the creation of migration-files (at least what I noticed).
I changed it to 'UTC' and it worked liked a charm again.
Note: the 'UTC+2' worked in the application and I never saw any other indications of errors regarding the rest of the app.php-file, or in the application in general.
Solution: When I instead used the parameters from this site it all worked perfectly again.
So I have been working on Laravel projects with no issues at my new job, however I decided it was time to get it up and running on my system at home which for purposes of this question is running MS Windows 10. I managed to get it all set up correctly, however upon trying to get the test app working just to make sure everything was correctly configured, I am unable to get passed the laravel welcome (welcome.blade.php) despite having the Routes.php file in place.
The clean project was git cloned directly from laravel/laravel and I had no issues with this working on my work computer when I very first started learning Laravel. I'm not getting any errors, the routes are simply not working!
Btw I had to create the Routes.php file manually for some reason, even though I created my migrations and did:
artisan migrate
The views directory I created called 'testview' is being completely ignored in the routes file when calling:
Route::get('/', 'TestController#index');
Controller code:
Return view('testview.index');
That is within the public function index() just for those who try to be smart and say "oh but you didn't have it contained within a method".
Please could someone help and tell me where I'm going wrong??
It seems that for some reason the version of laravel on GIT is out of date as I peformed a different command line action using Composer and that installed the latest version. So in closing I've sorted this out myself, thanks.
I have a strange issue with my Laravel 4.2 app.
I have two servers with DirectAdmin installed on both of them.
I use .env.testing.php on one, and .env.production.php on the second one.
First (testing) works fine, but on the second one the .env.production.php isnt handled at all.
I made a simple test and added echo 'test'; in the file on both servers - and on production nothing happend and as I expected on testing 'test' word was displayed on the screen.
I'll be glad for any tips, sollutions - anything than might help with this.
And, yes the server is recognised as production one, yes I tried to use putenv and getenv to see if it is doing its job - both works fine.
And no I have no idea why it's not working :/
Note: You may create a file for each environment supported by your application. For example, the development environment will load the .env.development.php file if it exists. However, the production environment always uses the .env.php file.
So I've recently developed a CMS with Laravel and its all working great - on my local machine that is...
When I upload it to my webserver I start getting file not found errors from what I believe is composer's autoloader.
The errors originate from the require $file on line 52 (I think, I'm not at the computer right now) in the vendor/composer/autoload_real.php.
I'm not familiar with composer at all so I'm not really sure where to start. All I do know is that it works fine on my localhost but doesn't work on my server with the exact same files. I am just lost as to what to try. Any ideas?
Thanks to everyone for their support. I've got it working now.
I deleted the vendor directory, installed composer on the server, updated my files to the ones provided at laravels github, ran composer install and finally re-uploaded my config, controllers and views.
This was necessary as composer update was giving me even more errors. Either way, I've finally got it working and you guys helped a lot.