REM Lancement Serveur Local

SET PHP_DIR=C:\Program Files\php\PHP 7.1.32
SET NGNIX_DIR=C:\dev.local.server\nginx\nginx-1.16.1


	c:

	REM Save current directory
	PUSHD %PHP_DIR%

	REM ===============================================
        REM	kill Nginx process
	taskkill /IM "nginx.exe" /F

	REM Start cgi script 
	REM ===============================================
	start php-cgi.exe -b 127.0.0.1:8001
	start php-cgi.exe -b 127.0.0.1:8002               
	start php-cgi.exe -b 127.0.0.1:8003               

	REM Langer Ngnix
	REM ===============================================
	cd %NGNIX_DIR%
	REM IN case already runing start to kill process
	taskkill /F /IM nginx.exe
	
	' nginx -s stop       
	start nginx
	
	REM Restore current directory
	POPD

	pause
	goto fin
	



REM About Seervice PHP
REM https://superuser.com/questions/628176/php-cgi-exe-as-a-windows-service
	
	set PHP_DIR=C:\wamp64\bin\php\php7.1.9
	sc create PHP binPath= "service.exe \"C:\wamp64\bin\php\php7.1.9\php-cgi.exe -b 127.0.0.1:8001 -c C:\wamp64\bin\php\php7.1.9\php.ini"" type= own start= auto error= ignore DisplayName= PHP

    sc create PHP binPath= "service.exe C:\wamp64\bin\php\php7.1.9\php-cgi.exe -b 127.0.0.1:8001 -c C:\wamp64\bin\php\php7.1.9\php.ini" type= own start= auto error= ignore DisplayName= PHP7.1.9

	sc start PHP    // to start PHP service.

    sc delete PHP   // to delete PHP service

    sc stop PHP     // to stop PHP service
	
    sc query PHP   // statuts of service PHP 
	
REM GUI:
    type "services.msc" at run then find "PHP" from the list and right click on it and select Start
	
	
:fin