Jump to content

Recommended Posts

Not sure if this is the right place to ask, but I'm trying to develop a few PHP "bots."

 

Everything works great if I call the script like:

 

php ./myscript.php

 

but as soon as I close the terminal, the script stops processing. I then try:

 

php ./myscript.php &

 

hoping it will run in the background. I get a process ID number, but nothing usually happens when I go this route. Is there any way I can actually set my script to run in the background, without needing to keep a terminal open?

Link to comment
https://forums.phpfreaks.com/topic/267903-php-cli/
Share on other sites

I could simply say "Yes", and have answered your question perfectly. Seeing as it's a "yes" or "no" question. Though, I'll be nice and add "by using & as you have" to the answer.

In other words: Yes, what you have done should work.

 

If you want more specific answers, you have to provide more information. Such as the code you're trying to run, what you mean with "nothing happens" (getting a PID is something happening, btw), and anything else that you think might be relevant to the problem at hand.

 

Also, I strongly recommend that you read this article.

Link to comment
https://forums.phpfreaks.com/topic/267903-php-cli/#findComment-1374565
Share on other sites

Unless you're actually going to help or post anything useful, why bother posting at all? Unless you're trolling. I do not believe this the place to troll. This is, in fact, a place where people CAN go and ask questions. I mean, unless I misread the description of this forum: "Do you need help with some code you wrote? Ask here! We'll get you the answers!" You know, the "ask here" part kind of makes it seem like I CAN ASK A QUESTION. As opposed to this like you've provided that states "Don't ask us questions"

 

First of all, I assumed that what I had done was correct. Since nothing was happening, I was trying to quadruple check my thought. By simply verifying that it should have worked, you actually have helped. All the rest of your post? Useless. If it is your habit of proving useless information, please do not bother in responding to any further posts I make. I prefer to talk to people who are actually willing to discuss the topic, not just post useless crap trying to make themselves look like they know more about the topic than they really do. You don't have to impress me, I promise. If you don't know the answer, just say I don't know- or don't reply at all! Just sayin.. Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/267903-php-cli/#findComment-1374582
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.