windows start nginx and php-fpm in background in the same bat

5,840

php-cgi locks the window. Try the solution nginx guys give on their page. PHP-FastCGI on Windows

Share:
5,840

Related videos on Youtube

Doua Beri
Author by

Doua Beri

Updated on September 18, 2022

Comments

  • Doua Beri
    Doua Beri almost 2 years

    I'm trying to create a bat file on windows 10 to start the nginx and php-fpm in background. At the moment I can do that but the command window (black window) remains open. If I close the window the php-fpm is terminated as well.

    here is what I've added in start.bat

    @ECHO OFF
    cd D:\servers\nginx-1.10.1\
    echo Starting Nginx...
    start /B cmd /K "D:\servers\nginx-1.10.1\nginx.exe"
    echo Start Php-cgi...
    start /B cmd /K "D:\servers\php-5.6.26\php-cgi.exe -b 127.0.0.1:9000 -c D:\servers\php-5.6.26\php.ini"
    EXIT
    

    this is what is printed on black window:

    Starting Nginx...
    Start Php-cgi...
    

    I want the window to automatically close, but keep the process(nginx and php-fpm) running.