Jump to content

msknight

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Posts posted by msknight

  1. Same problem as a post a few months ago, but a different cause.

    I write tools to support people running L2J servers, and I have a problem ...

    The script detects whether the gameserver is down, and if it is, then it it tasked with restarting it.

    The program correctly executes the script, which contains a command ...
    #! /bin/sh
    ./GameServer_loop.sh &.
    ... which then calls a looping .sh file.

    The issue of this is that, of course, the whole thing never ends and even if I shut down the gameserver, the program hangs ... presumably waiting for some return from the command so that the script can continue executing.

    This, obviously, won't happen.

    What I need is a way of running a system command, and telling the PHP script not to bother waiting for a response ... just continue running.

    Any ideas please?
  2. Sorry if I'm off the mark.  The second variable is the permissions, I believe.

    Here's some code I use in case it helps ...

    $file_loc = $server_dir . 'log' . $svr_dir_delimit . 'knightchat' . $svr_dir_delimit . 'chat.log';
    $dir_loc = $server_dir . 'log' . $svr_dir_delimit . 'knightchat';
    if (!is_dir($dir_loc))
    { mkdir($dir_loc, 0700); }

    I did have issues with writing directories that the script didn't have permissions to create.  It is a matter of working out what credentials the PHP script is running with.  I did this by setting a directory to 777, running the script to create the directory, then I could see what user name and group it created the directory with, by using the ls -la.  Then I tightened the security on the parent directory again.

    Re: the safe mode, I think there is no way other than to switch the php.ini file to not operate in safe mode.  I don't think it can be done by a session variable, but I'm no expert.
  3. Thanks very much for the help.

    I was right at the begining of my PHP project when I needed to talk with the gameserver via telnet, so I had to copy someone elses telnet code and adjust it.  The last two months has seen me learn a lot about PHP, but still not enough to get to this kind of detail yet.

  4. Hi All,

    Sorry for being a complete newbie  ;D

    A nice simple one for you.  I dabble in different languages, and am working on a PHP project to help people running L2J servers to administer the game.  My work is free to the community.

    I'm having a problem, however, with code that is passing two variables by reference.  I understand what I am doing, and I understand the error, which is that passing variables by reference is depreciated in the later versions of PHP.  I just don't know enough to be confident of my solution.

    Although setting the variable in the php.ini file will get around it, and I do set a temporary session variable, this isn't an ideal solution.  Also, although fumbling around in the dark is my prefered way of learning, when other people are using my code I sort of owe it to them to say, "I need help!" and then go get it ... hence I'm here.

    [code]$usetelnet = fsockopen($telnet_host, $telnet_port, &$errno, &$errstr, $telnet_timeout);[/code]This is what I'm doing wrong ... $errno and $errstr are being passed by reference, but if I don't pass them by reference I'm sort of stuffed.

    To my amateure mind, the other side is probably working on the reference and if I don't pass the right numbers, then it may well write in to an unknown place in memory.  That is why I'm concerned.

    If I do something like ...
    [code]$errnoref = &$errno;
    $errstrref = &$errstr;
    $usetelnet = fsockopen($telnet_host, $telnet_port, $errnoref, $errstrref, $telnet_timeout);[/code]... will that solve my problem; or will I just crash someones server!

    Any help gratefully appreciated.
×
×
  • 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.