Re: php and consol interface

From: Date: Mon, 30 Jan 2006 10:51:46 +0000
Subject: Re: php and consol interface
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-229458@lists.php.net to get a copy of this message
Gregory Machin wrote:
Thanks for the input .. yes my idea was to use an ".ini" to store the configs. Do you know of any tutorials for creating php command line interafaces / applications .. The biggest problem is that the 2 interfaces have to share the same config, other wise there could be hug problems ..
so write an underlying module that takes care of reading and writing ini settings. try this: http://www.devshed.com/index2.php?option=content&task=view&id=333&pop=1&hide_ads=1&page=0&hide_js=1 which is a tut. on using this: http://pear.php.net/manual/en/package.configuration.config.php
On 1/30/06, *Jochem Maas* <jochem@iamjochem.com <mailto:jochem@iamjochem.com>> wrote:
    Gregory Machin wrote:
Hi I'm developing a web interface for server admin in php, but the
    bos has
added a complication, he wants ssh / telnet colson for as well, is i
    your boss has just (theoretically) doubled the ammount of work you
    have to do,
    a cmdline interface is not something you bolt on as an after
    thought! it's
    just as much an interface (with all the potential hard work it takes
    to get
    it working properly) as an application webpage.
posible to create a consol app in php ? My original idea was
    to have a
couple of files that the web interface would you to stor the
    settings and
generate the configs, but now i have to rethink my planning
    because of the
consol interface. Would you have any sugestions on how to keep
    consistancy
between the 2 interfaces configurations ie. if the config is
    changed at the
    use a single config file (use a ini type file?) or maybe a DB. just make
    sure you have some kind of update locking (check out the flock()
    function for
    example) so that changes don't overwrite each other or bork the
    config file
    somehow.
consol it should be reflected on the web interfact..
    I don't think the real-time (on the cmdline) versus browser-time
    intertaction
    is an issue. especially if you consider that you could write the
    cmdline interface
    in the same way as the PEAR command works. the pear command is an
    executable php
    script that excepts many, many commands (relevant to PEAR
    isntall/repository management)
    which is called from your shell, e.g.:
    ?> pear install apc
    a normally SSH connection to the box gives access - rather than a
    direct connection to
    a port that hosts the cmdline application (or course its quite
    possible to write a php
    cmdline app. that runs as a telnet-like deamon, but personally I'd
    keep it simple
    and write a php shell script for which you need to SSH into the
    relevant box to
    use the script/tool.
Thanks for you time -- Gregory Machin greg@linuxpro.co.za <mailto:greg@linuxpro.co.za> gregory.machin@gmail.com <mailto:gregory.machin@gmail.com> www.linuxpro.co.za <http://www.linuxpro.co.za> www.exponent.co.za <http://www.exponent.co.za> Web Hosting Solutions Scalable Linux Solutions www.iberry.info <http://www.iberry.info> (support and admin) +27 72 524 8096


« previous php.general (#229458) next »