|
Posted by Jerry Stuckle on 02/25/07 14:13
Dikkie Dik wrote:
>> For real, could php-cli be useful for system admin tasks?
>
> Theoretically yes, but in practise...
>
In practice, yes. I do a lot of CLI scripts in PHP and they work quite
well.
>> 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.
>
I find I can do anything in PHP that I can do in the other languages.
Is there something you've found you can't do in PHP that you can in Perl
or Python?
>> 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:
>
A lot of people use PHP for a shell scripting language.
> - 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.
>
I don't know about on Windows (I don't have the file associations set up
to run them automatically), but they are on Linux. If they aren't on
your system, your system is broken.
> - 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.
>
As I said - I don't do them on 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
But then I also don't do Perl or Python scripts on Windows.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|