How do I place myself in the Symfony folder with the command in order to clear the cache?
The only way I know to access the Symfony files is by typing:
gksudo nautilus /opt/lampp/htdocs
But after using this command the terminal window gets inactvie. I need to open another terminal window to do other actions.
I am running on Linux and Symfony 3.
The command I am trying to use to clear the cache is:
php bin/console cache:clear
Otherwise, since I can open the Symfony files with the command above, is it safe to delete everything there is in Symfony/var/cache/dev ?
The new command to clear the cache in Symfony 3.3 is:
php bin/console cache:clear --no-warmup -e prod
Where -e prod is the environment, and can be either -e prod or -e dev. And yes it is safe to delete var/cache completely; that will delete all the cache.
EDIT #2 based on comments
Also, run the above command in the folder:
/opt/lampp/htdocs/Symfony
Related
I make changes local on my mac in dev mode.
After committing the changes I login via ssh to my server.
There I make the command git pull
Now I see my changes on my webpage.
Unfortunately this only works in dev mode.
When I change the mode to production mode in my .env file, then I do not see any updates. What can I do?
You probably need to clear the cache. This can be done with the following command :
php bin/console cache:clear
The following command solved the problem:
rm -rf var/cache/
php bin/console cache:clear --env=prod
to be sure
If you use phpfpm on your server, it can also be required to restart phpfpm service after the cache:clear.
This should not be used in production environemment :
rm -rf var/cache
Please help, I've tried everything;
The command works well on the development server, but not on live.
Before you mark it as duplicate:
The filename ends with Command.php
The Bundle is registered
The command is ContainerAware
The command is in the Bundle\Command directory and in the App\Bundle\Command namespace
I have tried:
clearing and warming up the cache on the server multiple times using the symfony console php console --env=preprod cache:clear and php console --env=preprod cache:warmup
listing available commands by calling the console without extra arguments php console --env=preprod
Is there any other way to force symfony to re-check available commands ?
For future reference:
The problem was that I connected to the remote host before deploy, and bash doesn't update symlink targets.
So the Command was not available in my current working directory.
A simple cd .., cd current solved it.
I developed a project using symfony2/PHP and now I am willing to shift this project to another machine how can I do the same
I tried following
1)I copied project folder to www folder of another machine
2)I edited app\config\parameters.yml on another system
but is not working its giving different erros
Can any one tell me exact staeps
Moving the source and the database should be enough. It is possible, you may have to clean cache.
php app/console cache:clear
Try clearing cache; open console / terminal and type php app/console cache:clear
Try chmod / chown or if you are on a windows machine, try change the owner, check permissions
Try re-run: php composer.phar update
Check your php-version and extensions. (See: http://symfony.com/doc/current/reference/requirements.html)
Cleaning the cache worked for me.
type php app/console cache:clear
I've been developing a Symfony2 app locally and am now at the stage where I would like to deploy it in it's production environment on a server.
I've uploaded all my files and tried to run:
php app/console cache:clear --env=prod
Which gives the following error:
As you can see, it's trying to write to my C:/ drive for some reason. Doing a regular cache:clear works fine, but I can't swap it to the production environment.
At this point, trying to use the app.php version simply loads a blank page. I can't figure out why my app would be trying to write to a directory on a previous server.
Help?
Try empty the cache folder
rm -rf app/cache/*
After this the cache:clear --env=prod command work properly.
I am trying to install Symfony 2.1.3 (latest). I am running composer and installs everything okay. The only error that I get is:
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
It's being installed under www folder. I am running nginx and followed the composer approach. I read on internet that apache should be run manually not as a service, however I am using nginx instead. Does apache still have any bearing on it? I'm using debian squeeze.
Edit: As per AdrienBrault's suggestion the error was because the timezone was not set in the php.ini. Only with --verbose I could see the warning. Thanks guys.
Apache is not related - PHP is called via command line.
Most likely is the permission in the cache folder: did you check if the user that runs the composer update can actually write the cache folder?
Try to manually run rm -Rf app/cache/dev (for production environment replace dev with prod) and see if you get any permission error.
Also you will get this error if the default.timezone setting is not configured in php when running in CLI. To verify just run
php --info | grep timezone
and check that the setting date.timezone is correctly configured.
On the security side, setting 777 to the folder is not the optimal solution - if you have ACL enabled you could use that to correctly set up the permission for the cache and logs folder. Read more at the Symfony2 official installation page
I had this same issue for a while and after hours of face to brick wall pounding I realized... I have a .gitmodule in my project, and on initial checkout these submodules are NOT initialized and as such are not there for your composer to update, which results in the above error.
Make sure you run the following
git submodule update --init src/Acme/Sadness/Bundle
of course replace src/Acme/Sadness/Bundle with YOUR project namespace.
Hope this helps someone not go through the same pain I just did.
If you have vendor folder already I would remove it and install symfony 2.1.3 again via "composer.phar install". Problem might be coming from outdated version of composer
I had the same problem and I resolve in this way.
execute this on the console
and you should see something like this
$ locate php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
/etc/php5/fpm/php.ini
the first line is probably your php.ini that appear when you do a phpinfo();
the problem is that when you execute composer update this no check the same php.ini
in my case the second line
all my sites work fine but always I had problems not now
after edit the second file and put the same time zone that you set in the first one
run
$ sudo service apache2 reload
and now
$ composer update
I hope that this work for you like work for me
regards
Emiliano