collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: problem with StartBot.php under linux  (Read 2806 times)

0 Members and 1 Guest are viewing this topic.

Offline End

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
problem with StartBot.php under linux
« 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

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: problem with StartBot.php under linux
« Reply #1 on: September 28, 2007, 01:12:12 am »
On line 67, replace

Code: (php) [Select]
$php_bin = trim(shell_exec('which php'));

with

Code: (php) [Select]
$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.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: problem with StartBot.php under linux
« Reply #2 on: September 28, 2007, 11:09:34 am »
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.

Offline End

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: problem with StartBot.php under linux
« Reply #3 on: September 28, 2007, 12:14:39 pm »
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

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 233
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal