I uploaded my symfony-project (V2.5) to the server (of my provider).
Now, I want to execute a command like
"$ php app/console assetic:dump --env=prod --no-debug"
But I have no access to a CLI (command line interface).
How can I submit such a command?
Thx
Thomas
If you don't have access to the server (via SSH for example), you can install
a bundle which allows you accessing the Symfony2 console via your browser.
Here is the one I'm using : ConsoleBundle.
Once installed, go to the console page (add /_console in URL after app_dev.php) and enter assetic:dump --env=prod --no-debug into the input field.
Related
I'm trying to run a command through a cron job in a Symfony 4 app.
I have created my command and it run success when I run manually from the console (from my symfony root directory)
C:\xampp\htdocs\MY-PROJECT>php bin/console MY-COMMAND /*It works fine*/
I installed CronBundle (https://packagist.org/packages/cron/cron-bundle) and I registered a cron job from the console:
C:\xampp\htdocs\MY-PROJECT>php bin/console cron:create
The cron job was successfully create in the database, and I try to run:
C:\xampp\htdocs\MY-PROJECT>php bin/console cron:run"
time: 0.15687298774719
The cron job seems to run but it doesn't do anything (but the console show the time elapsed). The cron_report database table report the error => "Could not open input file: bin/console"
It seems that the cron bundle run the command from a different directory than the one I use when I run the command manually (the root directory of the project).
I tried to run from the console "php bin/console cron:start", but a error message is thrown => "This command needs the pcntl extension to run." I'm running xampp on windows
The PHP pcntl extension does not run on Windows.
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.
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
I have cleared my symfony2 application and now cannot run the application because cannot generate proxies for entities from the command line while a few have actually been generated by default.
I have tried to run the command below which usually did the trick in earlier versions of symfony/ doctrine:
php bin/console doctrine:ensure-production-settings --no-debug --env=prod
But this time I only get the following response:
Query Cache uses a non-persistent cache driver, Doctrine\Common\Cache\ArrayCache.
Anyone know how to solve this?
Try
php bin/console cache:warmup --env=prod --no-debug
How ever the command you are trying
php bin/console doctrine:ensure-production-settings --no-debug --env=prod
is not for generating proxies, but for verifying that Doctrine is properly configured for a production environment.
And to actually to make sure you are ready for production , you need to use one of the cache drivers mentioned here
.
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.