I am new to PHP and Laravel 5 and working on Windows, Xampp-control. My pages run perfectly almost two days but after that changes made in .blade.php files do not show on browser. Even changing images in public folder have no effect. I re-installed the browser and switched the browser from Chrome to Firefox, but no effect. I found something on internet but couldn't get it. The link is as follows:
https://bugs.php.net/bug.php?id=40568
Is it due to it or something else is happening? What should I do?
Views are cached that's why this problem is encountering. A simple solution to resolve it is to clear the cache. And you can do it by the following artisan command.
php artisan cache:clear
Related
I forked a working php project from github to create some json files to it, but i can't test it because js and css won't load, i have never used php in my life, so i followed what the install guide said.
composer install
edit .env
php artisan migrate:refresh --seed -vvv
testing vendor/bin/phpunit
This was the guide.
What i did step by step.
installed wamp64
cloned the repo into www
installed composer
ran the composer install command on the right folder
created virtual host for the folder with wamps add a virtual host option, named targygraf.test
created a db with phpmyadmin and set pw
edited the .env file to targygraf.test and to use the db and pw i created
ran php artisan migrate:refresh --seed -vvv
It did what it should i suppose because the database built up, and i was able to access the page with the server.php file, except that css and js didn't load.
Checked with the inspector and they were linked like this http://targygraf.test/server.php/assets/js/targygraf.js, i have visited a TON of forums about the problem, every single one said that i have to turn rewite_module on and set AlloweOverride to All so i did. But still nothing, and as i said earlier, the app was working on another pc and is working online right now, so i'm guessing i did something wrong.
This is the original github link: https://github.com/valentinxxx/targygraf
Edit1: corrected step 5 and 7, added original link
this is a Laravel project, so if it's your first time with php, it becomes a little more complicated.
In a few words:
laravel uses the routes at /routes/web.php, so: it's using: Route::get('/', 'HomeController#getIndex')->name('index'); for the home
/app/Http/Controllers/HomeController#getIndex calls layouts.index view .
this view uses /resources/views/template.blade.php. You can check your css and js there.
You can replace {{ url('assets/css/style.css') }} for '/assets/css/style.css' and see if this way the browser finds the file.
Anyway, there are other possible problems, keep in mind your Apache server should open "[project_folder]/public"
What I did to resolve this problem
reinstalled wamp and composer
forked a clean repo of the project
ran composer install
set phpmyadmin pw
created mysql table
created virtual host, this time pointing to [project_folder]\public instead of [project_folder] (This is the important part as with pointing to [project folder] the page will load but without css, but with the address pointing to [project_folder]\public the page works perfectly)
ran php artisan migrate:refresh --seed -vvv
This is the admin panel of my newly installed, unaltered install of Magento 2.2.5 in XAMPP 7.0.30 / PHP 7.0.30:
I am brand new to this, but I have done my best to find an answer or even just a solution on my own. I need help.
I do not see any folder with the path localhost/pub/static/version1532138534/adminhtml/Magento/backend/en_US/extjs/resources/css/
I've been struggling with this all week. I've fresh installed both XAMPP and Magento, trying multiple versions.
I've tried different browsers, and changing my browsers settings, and clearing my browsers.
I've tried installing XAMPP and Magento on MacOS instead, and found a new issue, that prevented me from even getting to this step, which I then banged my head against for 6 hours or so before giving up and going back to Windows.
I've pored over the web trying to find a solutions, but I can't even find anyone with the same issue.
Obviously, I am doing something wrong... and I want to know what, but I just can't seem to find any answers.
do the static content deployment.
take backup of core_config_data table
go to phpmyadmin and run insert core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);
go to your magento root folder using command line.
run php bin\magento cache:flush
run php bin\magento setup:static-content:deploy -f
your problem will be resolved.
Solution:
If anyone is having the same issue, here is what worked for me.
I added "C:\xampp\php" to my system variables/path.
Search "System Properties" from the start menu and open it.(New Window)
Select the "Advanced" tab.
Click "Environment Variables". (New Window)
From "System Variables", select "Path".
Click "Edit"
Click "New"
Type "C:\xampp\php"
Hit "OK" x3.
This appears to have allowed me to use php commands in my command prompt.
Then, I ran the setup for the Magento file in "C:\xampp\htdocs\Magento\bin". (This may be redundant.)
[You can see a full list of available commands with "C:\xampp\htdocs\Magento\bin php Magento"]
Open a command prompt. (win+r, cmd, enter).
Navigate to the bin folder. (cd c:\xampp\htdocs\Magento{*this may be unique to your setup}\bin, enter)
Run the setup. (php Magento setup:install)
Finally, I deployed all static view files.
In the same directory as before deploy static files. (php Magento setup:static-content:deploy, enter)
After this, in a browser, I navigated to localhost/Magento, and ran through the Magento setup again, and the issue is resolved.
https://i.stack.imgur.com/gAEIQ.png
I tryed click ctrl + r, ctrl f5. Clearing cashe launching application on other browsers. All I want to do is to start work and learn.
enter image description here
anything I do at app/recources/views/default/index.html.twag is completely ignores, I even tryed deleleting whole content of this file, than restarting pc and it still appear as default view. Any changes made to controller is also ignored. He finally starts to notice me when i completely delete index.html.twag file. When i return it back (completely empty by the way) he shows me his default view AGAIN!!!. Please help, any ides?
So eventualy problem was with cache. All I had to do is to run command at my console: php bin/console cache:clear --env=prod
Source: http://symfony.com/doc/current/console/usage.html
When you make changes to your Twig files or your controllers, you should always clear the cache using:
php bin/console cache:clear --env=prod
for your production environment.
The DEV environment is done automatically, but sometimes you still need to clear it with:
php bin/console cache:clear
To access the DEV environment, just append app_dev.php to your route URL. For example: http://localhost/wtf/app_dev.php
If you open that file under the web folder, you'll see you can also add in the IP addresses of remote hosts that you want to allow access.
Hope that helps you.
After having installed Laravel 5.1 on a local desktop, I installed it on a webserver (debian 8, php 5.6.17), set the directory permissions for storage and bootstrap/cache tp 1777. All worked fine. Next I installed it on another webserver, same method, same settings, but now it only shows a coninuously loading page. Tried a re-install, with the same result
Started manual debugging and the code falters in the index.php at $kernel->terminate(.... I also changed caching and session storage to redis, which made no difference.
Have been reading through the 'blank pages' posts, and been googling on it too, without any helpfull result so far.
If I let the script die before the '$kernel->terminate(...' line it shows the page else it just shows the page loading ... Unfortunately, pagination, and sorting a.o. do not work due to the premature ending of the script.
Anyone encountered this peculiar behaviour before
Cheers,
It happens most probably due to permission issue.Try this
chmod 777 -R storage/
Storage folder existed inside the Laravel folder.If nothing works, try to give full permission to Laravel Project folder and try again.
Problem caused by NFS filesystem. It doesn't allow file locking. Solved the problem by writing sessions to memcached
For me what fixed my issue was removing some laravel comment in my blade files. Especially comments of html code on multiple lines.
It took afew days to figure it out!! Very annoying.
{{--
html code here
--}}
see:
Blade Comments in Laravel are crashing apache
Laravel - Blade comments , blade rendering causing page to crash
it's so annoying.
I'm working with Netbeans and Chrome (but other browers are not better) and i never know whether an error comes from last edited code or previosly edited.
app_dev.php suppose to take care of that, but its not.
I do not know whose cache is responsible for this: Netbeans, Symfony, Browsers.
How to contrain displaying latest version of my code?
edit
if do following steps its not work well:
physically delete cache (even command cache:clear --env=dev)
change code
refresh site
if do following steps its work well:
change code
physically delete cache (dev)
refresh site
Netbeans is an IDE. It will not cache any files I think. Try following this steps:
Use Ctrl+F5 in Chrome to refresh the page with discarding the browser cache
Execute php app/console cache:clear --env=dev after each source code modification
Check your URL in browser address. It should be something like http://localhost/web/app_dev.php
#Olim pretty much covered it all. Only thing I would add is to try physically removing cache directory and running cache:clear again...
EDIT:
I had numerous problems with access rights of my IDE (phpStorm in my case) which could not alter files stored in Apache's default location (C:\Program Files\Apache...). The main cause was the dreaded Windows's UAC which prevented any program to write in some more sensitive locations.
To solve this you can either disable UAC or you could set the proper ownership:
Right click on you project's directory
Click Properties
Click the Security tab, then Advanced button
Switch to Owner tab and then Edit button
Click Other users and groups and enter your username. Click OK
Make sure you check the Replace owner on ....
Restart all related software (Netbeans, Chrome, Apache service...)
Does it work now?