Skip to main content
added 173 characters in body
Source Link
Peregrino69
  • 4.7k
  • 3
  • 23
  • 30

I run PHP CLI on Windows 10. I have installed Windows Terminal via winget. For several reasons, I have long tried to switch from using cmd.exe to using either PowerShell or Windows Terminal for my PHP CLI scripts.

But, after spending a full day on experimenting with this, I have determined the following:

  1. Launching 100 PHP CLI scripts with cmd.exe barely is noticeable in CPU and RAM usage. I do this all the time. (Automatically, in the background, all launching minimized and grouping to the same Taskbar icon, performing all kinds of tasks concurrently.)

  2. Launching 100 PHP CLI scripts with PowerShell or Windows Terminal (yes, even with new tabs instead of new separate instances!) causes my powerful computer to become unusable. All CPU and tons of RAM is used, and all kinds of error messages start popping up and the Taskbar icon becomes impossible to click to show the windows; everything "glitches out".

  3. If I execute a command such as "php test.php" directly, without any terminal attached, it opens a PHP-branded window of some sort, but appears to use a cmd.exe "behind the scenes", so this is just the same as explicitly using cmd.exe.

My conclusion is that it's practically impossible to use anything other than cmd.exe for PHP CLI. I have searched, asked and experimented a lot related to this.

The main reason I needed to switch from cmd.exe in the first place is that the window changes styles whenever a PowerShell command is calledwindow changes styles whenever a PowerShell command is called from a PHP CLI script which was launched as/with cmd.exe, which does not happen if I use PowerShell or Windows Terminal.

But since both PowerShell and Windows Terminal are so extremely resource-hungry, I just cannot use them.

Is there some secret way to launch "minimal" versions of them or something? It doesn't seem like I could even buy a machine powerful enough to power my (relatively) few CLI instances.

I did not expect this to be an issue, and I don't understand how it can be the case no matter how "advanced" these terminals may be.

I run PHP CLI on Windows 10. I have installed Windows Terminal via winget. For several reasons, I have long tried to switch from using cmd.exe to using either PowerShell or Windows Terminal for my PHP CLI scripts.

But, after spending a full day on experimenting with this, I have determined the following:

  1. Launching 100 PHP CLI scripts with cmd.exe barely is noticeable in CPU and RAM usage. I do this all the time. (Automatically, in the background, all launching minimized and grouping to the same Taskbar icon, performing all kinds of tasks concurrently.)

  2. Launching 100 PHP CLI scripts with PowerShell or Windows Terminal (yes, even with new tabs instead of new separate instances!) causes my powerful computer to become unusable. All CPU and tons of RAM is used, and all kinds of error messages start popping up and the Taskbar icon becomes impossible to click to show the windows; everything "glitches out".

  3. If I execute a command such as "php test.php" directly, without any terminal attached, it opens a PHP-branded window of some sort, but appears to use a cmd.exe "behind the scenes", so this is just the same as explicitly using cmd.exe.

My conclusion is that it's practically impossible to use anything other than cmd.exe for PHP CLI. I have searched, asked and experimented a lot related to this.

The main reason I needed to switch from cmd.exe in the first place is that the window changes styles whenever a PowerShell command is called from a PHP CLI script which was launched as/with cmd.exe, which does not happen if I use PowerShell or Windows Terminal.

But since both PowerShell and Windows Terminal are so extremely resource-hungry, I just cannot use them.

Is there some secret way to launch "minimal" versions of them or something? It doesn't seem like I could even buy a machine powerful enough to power my (relatively) few CLI instances.

I did not expect this to be an issue, and I don't understand how it can be the case no matter how "advanced" these terminals may be.

I run PHP CLI on Windows 10. I have installed Windows Terminal via winget. For several reasons, I have long tried to switch from using cmd.exe to using either PowerShell or Windows Terminal for my PHP CLI scripts.

But, after spending a full day on experimenting with this, I have determined the following:

  1. Launching 100 PHP CLI scripts with cmd.exe barely is noticeable in CPU and RAM usage. I do this all the time. (Automatically, in the background, all launching minimized and grouping to the same Taskbar icon, performing all kinds of tasks concurrently.)

  2. Launching 100 PHP CLI scripts with PowerShell or Windows Terminal (yes, even with new tabs instead of new separate instances!) causes my powerful computer to become unusable. All CPU and tons of RAM is used, and all kinds of error messages start popping up and the Taskbar icon becomes impossible to click to show the windows; everything "glitches out".

  3. If I execute a command such as "php test.php" directly, without any terminal attached, it opens a PHP-branded window of some sort, but appears to use a cmd.exe "behind the scenes", so this is just the same as explicitly using cmd.exe.

My conclusion is that it's practically impossible to use anything other than cmd.exe for PHP CLI. I have searched, asked and experimented a lot related to this.

The main reason I needed to switch from cmd.exe in the first place is that the window changes styles whenever a PowerShell command is called from a PHP CLI script which was launched as/with cmd.exe, which does not happen if I use PowerShell or Windows Terminal.

But since both PowerShell and Windows Terminal are so extremely resource-hungry, I just cannot use them.

Is there some secret way to launch "minimal" versions of them or something? It doesn't seem like I could even buy a machine powerful enough to power my (relatively) few CLI instances.

I did not expect this to be an issue, and I don't understand how it can be the case no matter how "advanced" these terminals may be.

Source Link
Majd
  • 29
  • 2

Why are Windows Terminal and PowerShell so very inefficient compared to cmd.exe, and how to make them fast?

I run PHP CLI on Windows 10. I have installed Windows Terminal via winget. For several reasons, I have long tried to switch from using cmd.exe to using either PowerShell or Windows Terminal for my PHP CLI scripts.

But, after spending a full day on experimenting with this, I have determined the following:

  1. Launching 100 PHP CLI scripts with cmd.exe barely is noticeable in CPU and RAM usage. I do this all the time. (Automatically, in the background, all launching minimized and grouping to the same Taskbar icon, performing all kinds of tasks concurrently.)

  2. Launching 100 PHP CLI scripts with PowerShell or Windows Terminal (yes, even with new tabs instead of new separate instances!) causes my powerful computer to become unusable. All CPU and tons of RAM is used, and all kinds of error messages start popping up and the Taskbar icon becomes impossible to click to show the windows; everything "glitches out".

  3. If I execute a command such as "php test.php" directly, without any terminal attached, it opens a PHP-branded window of some sort, but appears to use a cmd.exe "behind the scenes", so this is just the same as explicitly using cmd.exe.

My conclusion is that it's practically impossible to use anything other than cmd.exe for PHP CLI. I have searched, asked and experimented a lot related to this.

The main reason I needed to switch from cmd.exe in the first place is that the window changes styles whenever a PowerShell command is called from a PHP CLI script which was launched as/with cmd.exe, which does not happen if I use PowerShell or Windows Terminal.

But since both PowerShell and Windows Terminal are so extremely resource-hungry, I just cannot use them.

Is there some secret way to launch "minimal" versions of them or something? It doesn't seem like I could even buy a machine powerful enough to power my (relatively) few CLI instances.

I did not expect this to be an issue, and I don't understand how it can be the case no matter how "advanced" these terminals may be.