Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony self-update failing

When I do symfony self-update I get the following error - how can I solve it?

Backup failed, rename D:\SERVER\Symfony\symfony.exe C:\Users\FairyWilbury\.symfo
ny\autoupdate\2019-07-19_14-57-14-79024bb-old: The system cannot move the file t
o a different disk drive.. Canceling upgrade.

UPD. I have just realized that the latest symfony version seems to be 4.3 with 4.4 due to release in November https://symfony.com/roadmap/4.4 Yet whenever I run symfony new --full %projectName% it suggests I should update to 4.6 (and then fails to update as described above). Screenshot of the command line: s What can this problem be?

like image 691
Anastasia Sitnina Avatar asked Sep 01 '25 15:09

Anastasia Sitnina


2 Answers

First of all, you're mixing up Symfony Local Web Server and the Symfony PHP framework. You can use the web server, which is a single executable command line developer tool, to start a new Symfony-based project or start a local server that makes your web application available for testing and debugging while you develop it. The framework, on the other hand, is the code base you build web application on.

When you run

symfony self-update

from the command line, you (try to) update the web server, not the framework.

The latest version of the web server, at the time of writing, is 4.12.10, while the framework is at 5.0.5 (or 4.4.5), so, as you can see, they're completely independent from each other.

Back to the original problem, and I was struggling with this as well, the catch is that we both use Windows and installed the web server (symfony.exe) to a folder in drive D: (in your case it's D:\SERVER\Symfony). While it's running, it stores config and other files in a ".symfony" directory in the folder of your Windows user account (C:\Users\FairyWilbury). And during the self-update process, that's where it tries to move the original symfony.exe file. For some unknown reason, it cannot do that between different drives, not even in an Administrator-privileged command line window.

Strange, as it is, the only solution I found was the following.

  1. I created a TEMP folder on drive C:
  2. Copied symfony.exe from its folder on drive D: to C:\TEMP
  3. Opened up command line, and switched the current dir to C:\TEMP
  4. Ran symfony self-update -- this time it went smoothly
  5. Closed the command line window
  6. Moved the new symfony.exe file from C:\TEMP to the folder on drive D:
  7. Removed C:\TEMP folder

I know it's a bit cumbersome, but we have to consider that Windows is not the most popular development platform for PHP applications. ;)

like image 87
Balage Avatar answered Sep 06 '25 14:09

Balage


This command helped me to update symfony binary:

sudo symfony self-update
like image 33
yesnik Avatar answered Sep 06 '25 16:09

yesnik