php-cgi.exe

PHP CGI Executable

Application ProcessSafeWeb Server Component
CPU Usage
1-15%
Memory
50-250 MB
Location
C:\Program Files\PHP
Publisher
The PHP Group

Quick Answer

php-cgi.exe is safe. It's the PHP CGI executable used by web servers to run PHP code. It may spawn worker processes per request or reuse a pool to handle multiple PHP scripts efficiently.

Is it a Virus?
✔ NO - Safe
Typically located in C:\Program Files\PHP\ or C:\PHP\; ensure the file is part of a legitimate PHP distribution.
Warning
Multiple php-cgi.exe processes can appear under load
Each FastCGI worker or request may spawn a php-cgi.exe instance; high counts can indicate configuration or attack.
Can I Disable?
✔ ES
Disabling requires server-level changes (e.g., disable CGI/FastCGI or remove PHP from the web server) and may affect PHP-enabled sites.

What is php-cgi.exe?

php-cgi.exe is the PHP CGI executable used by web servers to execute PHP scripts when CGI or FastCGI is configured. It launches to handle PHP requests, often spawning a per-request process or using a pool, depending on the server setup. It is common in Windows hosting stacks with IIS or XAMPP.

php-cgi.exe runs the PHP interpreter in CGI/FastCGI mode and communicates with the web server via STDIN/STDOUT. It handles PHP code execution for requests and typically runs in a managed pool to improve concurrency and isolation between requests.

Quick Fact: PHP-CGI helped establish CGI-style execution for PHP; FastCGI later improved performance by reusing worker processes.

Types of PHP-CGI Processes

Is php-cgi.exe Safe?

Yes, php-cgi.exe is safe when it comes from official PHP distributions and is invoked by a legitimate web server. Ensure you install from php.net or your server vendor.

Is php-cgi.exe a Virus or Malware?

The real php-cgi.exe is not a virus. Malware can masquerade with similar names; verify digitally signed and legitimate path.

How to Tell if php-cgi.exe is Legitimate or Malware

  1. File Location: Check that the file is located at C:\Program Files\PHP\php-cgi.exe or C:\PHP\php-cgi.exe. Unusual locations are suspicious.
  2. Digital Signature: Right-click the file in Explorer > Properties > Digital Signatures. Should show "The PHP Group" or a legitimate PHP distributor.
  3. Resource Usage: Typical per-request CPU/memory is modest; consistently abnormal CPU or memory when idle may indicate tampering.
  4. Behavior: PHP-CGI should be launched by the web server for PHP requests; persistent background activity with no server trigger is suspicious.

Red Flags: If php-cgi.exe is found outside typical PHP folders (e.g., Temp or AppData), runs without a web server trigger, lacks a valid signature, or shows constant high resource use, scan with antivirus and verify server configuration.

Why Is php-cgi.exe Running on My PC?

php-cgi.exe runs when a PHP-enabled web server processes requests. In CGI or FastCGI mode, the server may launch a new php-cgi.exe per request or reuse a pool of workers to handle multiple requests.

Reasons it's running:

Can I Disable or Remove php-cgi.exe?

Yes, you can disable php-cgi.exe. If you disable CGI/FastCGI support or remove PHP from the web server, the PHP scripts will no longer execute.

How to Stop php-cgi.exe

How to Uninstall PHP and php-cgi.exe

Common Problems: High CPU or Memory Usage

If php-cgi.exe is consuming excessive resources:

Common Causes & Solutions

Quick Fixes:
1. Open Task Manager or your web server's monitoring tool to identify high-usage php-cgi.exe processes.
2. Increase or tune FastCGI/Worker limits (e.g., MaxRequestWorkers).
3. Restart the web server to apply changes.
4. Update PHP and extensions to latest stable versions.
5. Enable OPcache and review long-running scripts for optimization.

Frequently Asked Questions

Is php-cgi.exe a virus?

No, the legitimate php-cgi.exe from PHP distributions is not a virus. Verify the path is a PHP installation directory (e.g., C:\Program Files\PHP or C:\PHP) and that it is digitally signed by a trusted PHP distributor.

Why is php-cgi.exe running when there is no web traffic?

php-cgi.exe may run due to a running PHP-FastCGI pool, background PHP tasks, or a misconfigured server that keeps workers alive. Check your web server's application pool settings and scheduled tasks.

Can I delete php-cgi.exe?

Only if you don't need PHP support on the server. Uninstall the PHP distribution or disable CGI/FastCGI in your web server; deleting the file without removing the web server configuration can cause PHP pages to fail.

Can I disable php-cgi.exe?

Yes. Disable CGI/FastCGI in the web server configuration or stop the PHP application pool. This will prevent PHP scripts from running until you re-enable it.

Why is php-cgi.exe running at server startup?

If CGI/FastCGI is enabled, the web server may initialize a PHP-CGI worker pool on startup to service requests quickly. This is expected behavior in properly configured environments.

How do I reduce php-cgi.exe memory usage?

Limit the number of concurrent PHP workers, enable OPcache, optimize PHP scripts, and consider switching to a persistent FastCGI pool rather than per-request spawning.

Related Processes