Process - The Process component executes commands in sub-processes.

Overview

Process Component

The Process component executes commands in sub-processes.

Sponsor

The Process component for Symfony 5.4/6.0 is backed by SensioLabs.

As the creator of Symfony, SensioLabs supports companies using Symfony, with an offering encompassing consultancy, expertise, services, training, and technical assistance to ensure the success of web application development projects.

Help Symfony by sponsoring its development!

Resources

Comments
  • Update Process.php

    Update Process.php

    Stop any registry based autoexec commands from executing when shelling.

    Running Windows CMD as Administrator puts you in C:\windows\system32.

    If you have a registry entry of ...

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
    "AutoRun"="@CD C:\\"
    

    Causes all sorts of issues without the /D option.

    From CMD /?

    /D      Disable execution of AutoRun commands from registry
    
    If /D was NOT specified on the command line, then when CMD.EXE starts, it
    looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
    either or both are present, they are executed first.
    
        HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
    
            and/or
    
        HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
    
    
    opened by rquadling 6
  • Fixed Process and ProcessBuilder to work on my system with CgiHttpKernel...

    Fixed Process and ProcessBuilder to work on my system with CgiHttpKernel...

    ... (2.0 Backport)

    • A working directory that does not exist does not work.
    • Descriptors formatting.
    • stream_set_blocking() takes integer not boolean as second parameter.
    • Streams on Windows that didn't set to non-blocking should only fread() when there are bytes to read and only fclosed() while being eof. Fixes PHP Bug #51800. See Issue #3.
    opened by hakre 3
  • Unset callback after stop

    Unset callback after stop

    As of yet, a Process instance can't free memory. The built-in callback has a self-reference to the intance not cleared after instance destruction. I've tried to change both buildCallback and https://github.com/symfony/process/blob/v2.7.6/Process.php#L1373 usage to avoid self-referencing, but it can't be done without breaking BC, and the memory issue is still there.

    A simple test script (that obiously can't be embedded in unit-tests)

    $echo = function($inc){
        echo (memory_get_usage(true) / 1000000) . ' MB ' . $inc . PHP_EOL;
    };
    for ($inc = 0; $inc < 10000; $inc++) {
        $process = new Symfony\Component\Process\Process('echo 1');
        $process->mustRun();
        $process->stop();
        unset($process);
    
        $echo($inc);
    }
    

    Before:

    1.572864 MB 0
    5.505024 MB 9999
    

    After:

    1.572864 MB 0
    1.572864 MB 9999
    

    Ok, in this simple scenario 4 MB of RAM is nothing, but in our business app full of IOC where unset-ting is hard, our RAM explodes.

    After stop(), the callback is no longer necessary.

    opened by Slamdunk 2
  • Change PHP executable find order (and handle PHP_PATH options)

    Change PHP executable find order (and handle PHP_PATH options)

    Change PHP executable detection order to allow PHP_PATH environment variable usage and override PHP_BINARY detection behavior. Specifically when you need to use a different php.ini.

    opened by Maxeee09 2
  • On Windows platform STDERR uses temp file too. Fixes blocking of processing.

    On Windows platform STDERR uses temp file too. Fixes blocking of processing.

    Due to php bug 51800, https://bugs.php.net/bug.php?id=51800, output from process must not use pipes. Both STDOUT and STDERR must be redirected to file.

    opened by jasir 2
  • Add a waiting callback

    Add a waiting callback

    Add the possibility to add a callback while waiting for the process to finish. This allows to add Logging or other actions.

    class Example {
    
        private PsrLogger $logger;
    
        function runMyProcess() {
            $process->wait(
                null, 
                function (ProcessStatus $ProcessStatus): void {
                        $this->logger->debug(
                            'Running Render Videofile process with PID ' . $meltProcessStatus->getSymfonyProcess()->getPid()
                        );
                }
            );
        }
    }
    
    opened by notdefine 1
  • Changed Process.php to include support for create_new_console (Windows ONLY)

    Changed Process.php to include support for create_new_console (Windows ONLY)

    I created a quick Repo https://github.com/andrei0x309/tets_sym_proc to illustrate how this feature can be used, it essentially lets you run something even if your main script has terminated.

    It is useful if you want to create something like new Process(['php', 'script_with_long_execution_time.php']); This was impossible to do on windows until the create_new_console flag was added in PHP 7.4.4. With this feature Process can be used like this:

    // Start a process and detach form it on Win only
    $process = new Process(['php', 'worker.php']);
    $process->setWinOptions(["create_new_console" => true]); // New method I added
    $process->disableOutput();
    $process->start();
    

    Process Class behavior will never change if the user doesn't use setWinOptions()

    opened by andrei0x309 1
  • Prevent warning in proc_open()

    Prevent warning in proc_open()

    In addition to returning false, proc_open() triggers a warning when it fails. For example:

    Warning: proc_open(): fork failed - Cannot allocate memory

    When using the ErrorHandler, the warning gets promoted to an exception, and the next line, if (! is_resource(..., is not executed.

    opened by BenMorel 1
  • Consider

    Consider "executable" suffixes first on Windows

    Executable finder should consider "executable" suffixes first on Windows because we basically ignore executability on Windows (line 80 below the change), which leads, for example, to finding usually-non-executable phpunit file first where both phpunit and phpunit.bat are present.

    opened by sanmai 1
  • Suppress warnings when open_basedir is non-empty

    Suppress warnings when open_basedir is non-empty

    While 709e15e7a37cb7ed6199548dc70dc33168e6cb2d did not "cause" this problem, it made it more apparent (because the other is_executable() calls are wrapped in conditional logic that makes them less likely to be executed).

    If PHP is configured with a non-empty open_basedir value that does not permit access to the target location, these calls to is_executable() throw warnings.

    While Symfony may not raise exceptions for warnings in production environments, other frameworks (such as Laravel) do, in which case any of these checks causes a show-stopping 500 error.

    We fixed a similar issue in the ExecutableFinder class via https://github.com/symfony/symfony/pull/16182 .

    opened by cbj4074 1
  • Suppress warnings when open_basedir is non-empty

    Suppress warnings when open_basedir is non-empty

    If PHP is configured with a non-empty open_basedir value that does not allow access to the target location, these calls to is_executable() throw warnings. While Symfony may raise exceptions for warnings in production environments, other frameworks (such as Laravel) do, in which case any of these checks causes a show-stopping 500 error.

    opened by cbj4074 1
Releases(v6.2.0)
  • v6.2.0(Nov 30, 2022)

  • v6.2.0-RC1(Nov 25, 2022)

  • v6.2.0-BETA3(Nov 19, 2022)

  • v6.2.0-BETA1(Oct 24, 2022)

  • v6.1.3(Jul 29, 2022)

  • v6.0.11(Jul 29, 2022)

  • v5.4.11(Jul 29, 2022)

  • v4.4.44(Jul 29, 2022)

  • v6.1.0(May 27, 2022)

  • v6.1.0-RC1(May 14, 2022)

  • v6.0.8(Apr 27, 2022)

    Changelog (https://github.com/symfony/process/compare/v6.0.7...v6.0.8)

    • bug #45931 Fix Process::getEnv() when setEnv() hasn't been called before (asika32764)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.8(Apr 27, 2022)

    Changelog (https://github.com/symfony/process/compare/v5.4.7...v5.4.8)

    • bug #45931 Fix Process::getEnv() when setEnv() hasn't been called before (asika32764)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.41(Apr 27, 2022)

    Changelog (https://github.com/symfony/process/compare/v4.4.40...v4.4.41)

    • bug #45931 Fix Process::getEnv() when setEnv() hasn't been called before (asika32764)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.0-BETA1(Apr 15, 2022)

    Changelog (https://github.com/symfony/process/compare/v6.0.7...v6.1.0-BETA1)

    • feature #45377 Bump minimum version of PHP to 8.1 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.7(Apr 2, 2022)

    Changelog (https://github.com/symfony/process/compare/v6.0.6...v6.0.7)

    • bug #45676 Don't return executable directories in PhpExecutableFinder (fancyweb)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.7(Apr 2, 2022)

    Changelog (https://github.com/symfony/process/compare/v5.4.6...v5.4.7)

    • bug #45676 Don't return executable directories in PhpExecutableFinder (fancyweb)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.40(Apr 2, 2022)

    Changelog (https://github.com/symfony/process/compare/v4.4.39...v4.4.40)

    • bug #45676 Don't return executable directories in PhpExecutableFinder (fancyweb)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.5(Feb 28, 2022)

  • v5.4.5(Feb 28, 2022)

  • v6.0.3(Jan 28, 2022)

    Changelog (https://github.com/symfony/process/compare/v6.0.2...v6.0.3)

    • bug #45103 Avoid calling fclose on an already closed resource (Seldaek)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.3(Jan 28, 2022)

    Changelog (https://github.com/symfony/process/compare/v5.4.2...v5.4.3)

    • bug #45103 Avoid calling fclose on an already closed resource (Seldaek)
    Source code(tar.gz)
    Source code(zip)
  • v5.3.14(Jan 28, 2022)

    Changelog (https://github.com/symfony/process/compare/v5.3.13...v5.3.14)

    • bug #45103 Avoid calling fclose on an already closed resource (Seldaek)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.37(Jan 28, 2022)

    Changelog (https://github.com/symfony/process/compare/v4.4.36...v4.4.37)

    • bug #45103 Avoid calling fclose on an already closed resource (Seldaek)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.2(Dec 29, 2021)

    Changelog (https://github.com/symfony/process/compare/v6.0.1...v6.0.2)

    • bug #44538 fixed uppercase ARGC and ARGV should also be skipped (rbaarsma)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.2(Dec 29, 2021)

    Changelog (https://github.com/symfony/process/compare/v5.4.1...v5.4.2)

    • bug #44538 fixed uppercase ARGC and ARGV should also be skipped (rbaarsma)
    Source code(tar.gz)
    Source code(zip)
  • v5.3.13(Dec 29, 2021)

    Changelog (https://github.com/symfony/process/compare/v5.3.12...v5.3.13)

    • bug #44538 fixed uppercase ARGC and ARGV should also be skipped (rbaarsma)
    • bug #44261 intersect with getenv() in case-insensitive manner to get default envs (stable-staple)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.36(Dec 29, 2021)

    Changelog (https://github.com/symfony/process/compare/v4.4.35...v4.4.36)

    • bug #44538 fixed uppercase ARGC and ARGV should also be skipped (rbaarsma)
    • bug #44261 intersect with getenv() in case-insensitive manner to get default envs (stable-staple)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0(Nov 29, 2021)

    Changelog (https://github.com/symfony/process/compare/v6.0.0-RC1...v6.0.0)

    • bug #44261 intersect with getenv() in case-insensitive manner to get default envs (stable-staple)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.0(Nov 29, 2021)

    Changelog (https://github.com/symfony/process/compare/v5.4.0-RC1...v5.4.0)

    • bug #44261 intersect with getenv() in case-insensitive manner to get default envs (stable-staple)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0-RC1(Nov 24, 2021)

    Changelog (https://github.com/symfony/process/compare/v6.0.0-BETA3...v6.0.0-RC1)

    • bug #44208 exclude argv/argc from possible default env vars (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
Builds Cycle ORM schemas from OpenAPI 3 component schemas

Phanua OpenAPI 3 + Jane + Cycle ORM = ?? Phanua builds Cycle ORM schemas from OpenAPI 3 component schemas. Released under the MIT License. WARNING: Th

Matthew Turland 5 Dec 26, 2022
Laravel URL Localization Manager - [ccTLD, sub-domain, sub-directory].

Laravel URL Localization - (ccTLD, sub-domain, sub-directory). with Simple & Easy Helpers. Afrikaans Akan shqip አማርኛ العربية հայերեն অসমীয়া azərbayca

Pharaonic 2 Aug 7, 2022
UpToDocs scans a Markdown file for PHP code blocks, and executes each one in a separate process.

UpToDocs UpToDocs scans a Markdown file for PHP code blocks, and executes each one in a separate process. Include this in your CI workflows, to make s

Mathias Verraes 56 Nov 26, 2022
YCOM Impersonate. Login as selected YCOM user 🧙‍♂️in frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files

Quality Hook Installer Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files Install

Kay W. 2 Dec 15, 2022
`phplint` is a tool that can speed up linting of php files by running several lint processes at once.

`phplint` is a tool that can speed up linting of php files by running several lint processes at once.

安正超 887 Dec 30, 2022
Our team created for you one of the most innovative CRM systems that supports mainly business processes and allows for customization according to your needs. Be ahead of your competition and implement YetiForce!

We design an innovative CRM system that is dedicated for large and medium sized companies. We dedicate it to everyone who values open source software,

YetiForce Sp. z o.o. 1.3k Jan 8, 2023
This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

PHP-introduction This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

Tyler Jacques 1 Jan 6, 2022
A PHP Package to work with OS processes in an OOP way.

OS Process This package is a wrapper around the Symfony Process component, and build up an API that is object-oriented and user-friendly. Installation

Steve McDougall 58 Jan 1, 2023
The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.

netz98 magerun CLI tools for Magento 2 The n98 magerun cli tools provides some handy tools to work with Magento from command line. Build Status Latest

netz98 758 Dec 28, 2022
Versi dinamis dari spk fuzzy sebelumnya, kini support setting jumlah sub kriteria

spk-fuzzy-dynamic Versi dinamis dari spk fuzzy sebelumnya, kini support setting jumlah sub kriteria SPK-Pariwisata-Fuzzy Implementasi Fuzzy Tahani Pad

Huda Mustakim 3 Mar 22, 2022
Scope your application's data by (sub-)domain.

This package adds domain-scoped content to your application. Content will be available based on the current (sub)-domain allowing "multiple" websites to run off the same code base.

Snoeren Development 2 Jan 3, 2023
An enhanced FileInput widget for Bootstrap 4.x/3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)

yii2-widget-fileinput The FileInput widget is a customized file input widget based on Krajee's Bootstrap FileInput JQuery Plugin. The widget enhances

Kartik Visweswaran 227 Nov 6, 2022
An enhanced Yii 2 widget encapsulating the HTML 5 range input (sub repo split from yii2-widgets)

yii2-widget-rangeinput The RangeInput widget is a customized range slider control widget based on HTML5 range input. The widget enhances the default H

Kartik Visweswaran 19 Mar 12, 2022
An extended bootstrap alert and alert block widget for Yii2 (sub repo split from yii2-widgets)

yii2-widget-alert This extension contains a couple of useful widgets. The Alert widget extends the \yii\bootstrap\Alert widget with more easy styling

Kartik Visweswaran 28 Mar 12, 2022
A PHP package that retrieves Uganda's districts with their respective counties, sub counties, parishes and villages in Uganda.

This package gives you the leverage to access all sub levels ranging from districts, counties, subcounties, parishes to villages in Uganda. You can also access the different mentioned areas independently.

Joshua Kusaasira 2 Oct 28, 2022
Easily add sub domains to your CakePHP application using route prefixes

Easily add sub domains to your CakePHP application using route prefixes. Based on code created by chinpei215.

multidimension.al 4 Feb 28, 2019
QPM, the process management framework in PHP, the efficient toolkit for CLI development. QPM provides basic daemon functions and supervision mechanisms to simplify multi-process app dev.

QPM QPM全名是 Quick(or Q's) Process Management Framework for PHP. PHP 是强大的web开发语言,以至于大家常常忘记PHP 可以用来开发健壮的命令行(CLI)程序以至于daemon程序。 而编写daemon程序免不了与各种进程管理打交道。Q

Comos 75 Dec 21, 2021
Http-kernel - The HttpKernel component provides a structured process for converting a Request into a Response.

HttpKernel Component The HttpKernel component provides a structured process for converting a Request into a Response by making use of the EventDispatc

Symfony 7.8k Jan 9, 2023
[ABANDONED] PHP library for executing commands on multiple remote machines, via SSH

#Shunt Inspired by Ruby's Capistrano, Shunt is PHP library for executing commands on multiple remote machines, via SSH. Specifically, this library was

The League of Extraordinary Packages 436 Feb 20, 2022