|
Posted by Dikkie Dik on 02/25/07 11:10
> For real, could php-cli be useful for system admin tasks?
Theoretically yes, but in practise...
> I doubt php-cli will ever match perl, or python, for a sys admin
> scripting language. But, does php-cli come close enough to the sys
> admin power of those languages that php might actually be useful for
> admins?
I am afraid that all depends on the OS and off course what you want to do.
> As far as I know, nobody seriously uses php for a shell scripting
> language. Is that just because perl is so well established? Or because
> php doesn't have the power?
I *did* try it. There are things that should be done on a web server
with scripts, and PHP is the only language that is guaranteed to exist
on both the development machine and the servers the site has to be run
on. And PHP tends to be pretty OS-inspecific, so I wanted at least some
testscripts done in PHP. There are a few drawbacks:
- Parameters are not passed, unless you specifically call the language
interpreter. so "testdir.php somedir" will not see the somedir
parameter, but "C:\PHP\php.exe testdir.php somedir" will. I think a
sysadmin was able to fix this under linux, but I do not know how.
- When running windows, created directories are read-only. I had to
shell out to dos just to create a directory in a useful way. Off course,
all OS-independence stops here. Under linux, you can give the create
flags, but these are ignored in windows.
> ..., but all I find were "hello world" type examples.
Well, that will work, but the rest may requires som more testing, I'm
afraid.
Best regards
Navigation:
[Reply to this message]
|