Symfony completely ignores all the changes I make to code - php

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.

Related

How to fix laravel v6.18.38 after mistake in cache driver selection?

After a mistake in the laravel .env (cache_driver was set incorrectly to "data") the complete systems is broken. I have changed the driver name back to a valid value ("file") but still literally any "php artisan ..." command replys with "InvalidArgumentException : Cache store [data] is not defined.". So it seems the change in the .env is simply ignored. Also composer dump-autoload fails with the same error.
If you run into an issue where you have a cached configuration and you have errors that stop artisan from running you can delete this cached configuration file manually, the file is:
bootstrap/cache/config.php
As a side note, if you are developing locally, there isn't much need to cache your configuration or routes. Doing so will often get in your way as you will update things and not see the changes until you cache the configuration/routes again or clear the cached configuration/routes. Obviously if you are deploying this to your server caching these things is a benefit.

How to make wamp/apache to use htaccess?

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

Windows>XAMPP>Magento 2>Chrome.... Broken out of Box

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

Dev visible in app_dev.php but not visible in app.php

I work on an app in symfony 2 which uses the sonata-admin bundle.
I added 6 vars in my entity, and I can edit their value in my back-office to see the result in the front office.
Everything works fine when I go to my website in app_dev.php (and app_dev.php/admin for the back office)
But when I try to access to the website within the app.php, the changes don't show in my front office and I have a 404 error in the back.
If I explicite the vars's typos in the $formMapper of the sonata admin's configureFormFields function, I can see my form but it doesn't get back the values already stored in the database.
I must precise I tried all clear cache options possible, with --env, --no-debug, and I tried to delete the app/cache/prod folder, create it again with the permissions. Apache logs do not show anything in particular.
Thank you for your help.
try to clear cache with
php bin/console cache:clear --no-warmup --env=prod

app_dev.php not always refreshing . How to contrain Netbeans/Browser to display freshest version of code?

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?

Categories