I was given a lot of legacy code using Symfony2, which was running on Linux, but I need to start it on Windows. Almost everything is working (XAMPP), but I have problem with one thing.
During the user registration, sending mails was taking too long to load confirmation page (depending on the options there could be a couple of emails), so for every email there's a record added in DB, which contains just a command, like "php /path/to/app/console product:send_some_mail address@host"
etc.
Then there's a Command which takes all those not sent emails and sends it one by one. That command was previously called like this:
$proc = new Process('php /var/www/product/app/console product:send_all_mails ' . $mailAddress .' --env='. $env . ' ');
That's quite obvious the path was not exacly right on Windows, so I tried to make it more universal. I'll paste the whole test code:
$proc = new Process('php ' . realpath($this->get('kernel')->getRootDir() . '/console') . ' product:send_all_mails ' . $mailAddress .' --env='. $env . ' ');
$proc->setEnhanceWindowsCompatibility(false); // this doesn't change anything...
$proc->start();
while($proc->isRunning()); // stupid debug
file_put_contents("MailProcessResult.txt", $proc->getCommandLine() . ' :: ' . $proc->getExitCodeText());
Strangely, everything I see in the pseudo-log file is:
php C:\gitrepos\product\app\console product:send_all_mails mymail@host.com --env=my_env :: General error
I have no idea, what's going on. I double-checked everything I could think of:
- php.exe is in %PATH%
- the command works, if is called from cmd, even with Windows Compatibility (
cmd /V:ON /E:ON /C "(my_commandline)"
) - sendmail is configured correctly, other mails are sent without problems
- I removed ConEmu which was taking over cmd
- yes, on Linux it works
Earlier I tried to run the product:send_all_mails as command, but it wasn't running in background. That's quite obvious php has some problems executing php :)
What else could I try? I just need to run a batch of different Commands with different arguments from one Command (or Process) in background.