-2

I have a PHP script inside c:users\xampp\htdocs\myapp\myphpscript.php

What I want is to make a windows service that runs this PHP script in the background. So I searched for some questions here but they were not effective. Is there anyone who can help me to make a windows service using nssm that executes for my script.

MoJustNow
  • 3
  • 3
  • Q: why not just use Windows Task scheduler, and call your script directly? – paulsm4 Oct 10 '22 at 18:58
  • You need to do the [appropriate amount of research](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) and make some attempts yourself first. If you get stuck on something specific along the way, post a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) and explain where you're stuck. You should also read [how to ask](https://stackoverflow.com/help/how-to-ask). We can help if you get stuck with your implementation, but this question is currently way too unfocused and broad. – M. Eriksson Oct 10 '22 at 19:04
  • You are right , i will share my code and what i jave still done. – MoJustNow Oct 10 '22 at 19:13
  • STRONG SUGGESTION: forget about nssm; forget about the complexity of writing a true "Windows Service". Just invoke your PHP script from Windows Task Scheduler (or, alternatively, launch it from Windows Startup). Extra credit bonus points: consider using PowerShell. – paulsm4 Oct 10 '22 at 20:25

1 Answers1

1

Create a batch file with following content and put it in windows startup ;)

start /b path-to-php-installation\php c:\users\xampp\htdocs\myapp\myphpscript.php

Zubair Ahmd
  • 208
  • 1
  • 9