BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => BeBot 0.4 support => Topic started by: End on September 27, 2007, 08:32:58 pm
-
Hi all,
i'm running several bots under linux, but i've been starting the bots from Main.php.
recently i took another stab at getting StartBot.php to work, because its a pain to keep rebooting the bots if they go down.
when i try to run the startbot.php i get the following error:
PHP Notice: Undefined offset: 1 in /home/botname/StartBot.php on line 76
sh: /php: No such file or directory
at line 76 is: $last_line = system($php_bin . $php_args . " " . $main_php . " " . $argv[1]);
after changing the startup line to:
$last_line = system("/usr/bin/php -c ./Main.php");
the first error drops off but still left with:
sh: /php: No such file or directory
it still wont run, however it does run when its issued from a normal shell. (i.e. typing: /usr/bin/php -c ./Main.php)
also i use nohup to make it run in unattended mode, does anybody have a startup string for me that they use to make this happen under linux?
thanks,
End
-
On line 67, replace
$php_bin = trim(shell_exec('which php'));
with
$php_bin = trim(shell_exec('which php'));
print_r($php_bin);
// Use the right php binary.
$php_bin = "/usr/bin/php";
This will echo out what it is auto detecting for your php binary. It could be you have another php executable somewhere in your path before the one that works. The last line also hard codes the php path, but if you can sort out your extiting $PATH setting you should be able to get it to work without hard coding the path to php.
-
when i try to run the startbot.php i get the following error:
PHP Notice: Undefined offset: 1 in /home/botname/StartBot.php on line 76
sh: /php: No such file or directory
at line 76 is: $last_line = system($php_bin . $php_args . " " . $main_php . " " . $argv[1]);
Uhm right, the file should check the number of command line arguments before using the first one. I'll add that when I find the time. For the moment you can savely remove the " " . $argv[1] part if you aren't sharing files among several bebots.
also i use nohup to make it run in unattended mode, does anybody have a startup string for me that they use to make this happen under linux?
Ever tried screen? I'm using that, so I don't need nohup.
-
hi,
i've tried what you suggested, however no success yet.
when i try:
/usr/bin/php /home/bot/Main.php
from the shell, the bot starts.
that exact same line put into the system() command line the StartBot.php file however does not work.
could it be a permission problem? that the system() command runs under the php program permissions, and cant see the /usr/bin/php?
btw 'which php' returns the correct path to php