Laravel app downloading all assets again on every route request - php

I have a strange error in my Laravel(5.6)/app. Whenever there is any route request in the app, all css, js, bootstrap and icons files reload all over again in the browser. I'm debugging this app from last 2 days. And I have no clue what's going on.
I worked on this project a few days ago and it was working fine then I started working on some other project and after a couple of days when I worked again on this project to add some new features, it is behaving like this. Whenever I request any route in the app, all the assets download and load again in the browser. I didn't provide any code sample here because I don't know where the error might be.
If there have been an error in some particular file then that particular route would have behave that way. But all routes reload all the assets all over again. So I just want your opinion is this ever happens to you and how should I tackle it?
If you wanna recreate this project then here is the GitHub link. Git Repo . Recreating this project is very easy. Just create a database. run migrations and then seed the database. For sass and js ,run 'npm run dev' if needed.
Update: Solution to this problem is, don't use buit-in server of laravel, it sucks. Use any php development stack like xampp, wamp etc. and it will work fine.

Related

October CMS installation running on Laravel Homestead, server returning mixed up static assets

I've been developing a website built on OctoberCMS, using the Laravel Homestead vagrant box as my local development server and have so far been getting along swimmingly. I developed most of a theme this way.
However I've recently started running into a problem wherein requests for assets/vendor.css in the theme assets succeed but receive a text/html response containing HTML for the homepage instead of the proper CSS.
This means vendor CSS for the page doesn't load. However if you repeat the request for vendor.css with "open in new tab" after page load the correct asset is returned, and the Chrome 'sources' tab also shows the correct asset.
This strange behaviour seems to extend to JS assets. I'm currently looking at a request for assets/vendor/jquery.js where the inital response actually contains the contents of assets/theme.css - and this is causing JS errors in the console.
In this case however if I make the request to that URL again I actually still receive the same incorrect CSS, but once again the Chrome 'sources' tab actually shows the correct asset.
Inspecting the files in my code editor I see the correct assets under the correct filenames and locations.
It seems I might have an issue with Homestead's web server. However I'm confused about where it might have come from as I haven't reconfigured anything and this has been working fine previously.
I've confirmed that the problem still persists even after deleting the homestead VM, and then building a brand new one and installing a fresh copy of OctoberCMS, without importing any of my own custom theme files.
I tried having a look into the nginx logs on the VM to see if I could spot anything odd, but it looks like they all have no content, 0 lines.
I'm a bit stumped and haven't found much helpful searching around.
Any suggestions? Help much appreciated.
So I've managed to re-build my project in such a way that this time I didn't reproduce the problem.
I'm pretty sure that ultimately it was caused by the fact that I relocated the homestead VM (and projects therein) by renaming its containing folder.
In previous attempts I had been deleting the VM by running vagrant destroy and then re-creating it by running vagrant up.
Once I completely deleted the homestead repository and re-cloned it from scratch from laravel/homstead on github, then proceeeded to vagrant up and set up OctoberCMS, I no longer experienced the issue.
I suspect perhaps the original path to my VM (before rename) was still in a configuration file somewhere in the laravel/homestead project and the disconnect between this value and the actual filepath was causing the problem.

Having trouble configuring Laravel

I'm using Laravel with intellij and whenever I run my project this is what it looks like in the web browser
I'm not sure if I set up Laravel correctly on intellij. I set it up for XAMPP because I thought that was the problem however my pages are still looking like the image above.
probably it's not laravel problem. Maybe is better to setup local server in right way. You can try:
php artisan serve
under laravel root dir and then open in http://localhost:8000 in browser
Those icons are trying to use php built in server and may not be configured to match your laravel project. I get the same thing as you with localhost:63342 when clicking web browser preview icons in my Symfony project. I just configured phpStorm preview icons to load based on my web server root.
When using laravel, trying to load your blade views directly will most likely run into issues. Your request is not being mapped to a route/controller for it to be properly handled. For my symfony project and after configuring phpStorm, i get sent to app.dev/app/Resources/views/test.php, which is not a valid route (proves point of previous sentence). You will most likely get the same issue in your laravel project.
You can configure your phpStorm preview icons to load to your localhost:8000 / app.dev or whatever you may have set your app host to.
Follow the below phpStorm articles if you want to mess with this some more.
https://www.jetbrains.com/help/phpstorm/2016.3/working-with-web-servers-copying-files.html
https://www.jetbrains.com/help/phpstorm/2016.3/creating-a-local-server-configuration.html

Laravel not showing the new changes

Any idea on this? I am currently using Laravel 4.2.
We have an existing web application already running in live. Something needs to be changed so I downloaded all the files from live server to my localhost via ftp and do the update in there. Everything is working fine in localhost but when I tried to upload(ftp) the select files (that were only updated- a blade file, a controller and a model), and and test the live site, the changes aren't showing. Checked the html elements thru browser dev tools and indeed it's just the old version. The id that I newly added in the div isn't there.
I checked in the filemanager if the files were successfully updated and it's there.
I am done doing the following:
cleared my browser cache, cleared files in /app/storage/views. What else to do?
Is updating the files thru FTP for laravel not good? Honestly I am just a newbie to this framework so your explicit explanation would be appreciated. Thanks!
Laravel compiles all files before they are deployed most times. If the files are not recompiled on the server, then it's gonna keep running the old setup. if you have terminaal access, runningphp artisan clear-compiled may fix your problem. I may be wrong but this is what i see from where i'm sitting.

Laravel 4 - Local to Staging 404 issue

I hope that this isn't too broad a question but I have been developing a site locally for a month or so and am ready to put it up on my staging server. The deployment all went smoothly after a little issue installing Mcrypt but all is good now, except for in my staging environment I get a 404 on every route.
They way my application is structured is I have folder in app that contains each of my modules, each module (Users, Auth, Teams etc.) each have their own routes.php file aswell as controllers/models/repositories etc.
If I access the site using say /login I recieve a 404, however, If i was to quickly create that route in the main routes.php file in app/ it works which is leading me to believe that for some reason the server isn't loading the individual modules files.
Can you give me a hand narrowing it down, what sort things should I look at etc?
Thanks in advance.
Ok so I found out the issue.
For some reason my local (homestead) environment wasn't too bothered about case sensitivity, however, my staging server was. A few tweaks and I am up and running, cheers for the ideas though :)

Deploy CodeIgniter Php app on heroku

I am trying to deploy a php application having CodeIgniter as a framework in heroku.
I followed the steps here until the "Process and dyno tuning" part and managed to deploy my application. The first page works fine, but that's all. For any other page with codeigniter links(/index.php/home/link/ for the home controller, link action) I try to access, the server renders me the same first page. I thought that CI requires some of heroku extensions but here it says it only needs php. Do you happen to know what extensions do i have to provide?
The link to the website is this, and a test url should be this
This is defiantly a URI issue, Please try switching $config['uri_protocol']
from AUTO to any of the available modes until you get it fixed.
If you need a fast fix for this, just add ? for your index.php urls so it will be like this
index.php?/locations/get
but fixing this through the 'uri_protocol' thing is better.

Categories