Cron Bundle fail run bin/console on symfony 4 - symfony

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.

Related

Symfony : migration fail because the command run an unexpected old version

From Symfony 4, I am on (migration) version 20190708084642 and the only next version is 20190708121109 (I generated a Migration file named "Version20190708121109.php")
If I execute the command ./bin/console doctrine:migrations:migrate, I get this SQL error :
because the ./bin/console doctrine:migrations:migrate command run a old migration file. Why this command execute an old migration file ? (the 20190701095432)
Is it normal ?
EDIT : in my database, my current migration version is 20190708084642, I see this same current version also when I execute the command ./bin/console doctrine:migrations:status
i don't know if this will solving your problem, but, in my case, i change my sql from phpMyAdmin to MySql 5.7. and my problem is done

Symfony2 custom console command appears as “not defined” upon execution

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.

Symfony 3, linux: how to clear cache?

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

Unable to execute "doctrine:fixtures:load"

I am running Symfony 2.8.7 on my local machine. I installed Data Fixtures using composer and I am not able to execute following command:
php app/console doctrine:fixtures:load
It tells me there are no commands defined in the "doctrine:fixtures" namespace. What am I doing wrong?

Executing "php app/console"-commands on the server

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.

Resources