OS modules not called when interfacing with PHP

Robin Munn rmunn at pobox.com
Thu Oct 31 00:31:41 CET 2002


On Wed, 30 Oct 2002 at 00:36 GMT, Karen <TengFactor at aol.com> wrote:
> I'm new at Python so bear with me...
> 
> Okay, so I've written a Python script and saved it as a .cgi file. If
> I call this script directly from the command line, it runs just fine.
> But when I call this script from a PHP file, then my program goes
> buggy and can't process some of the os and os.path modules.
> 
> Basically, it can read os.path.exists("someDir"), but not
> os.system("...") calls or os.path.walk("...root...", visit, 'show').
> (It doesn't call the respective function "visit")
> 
> What is happening? Is there something wrong with my permissions level?
> Any help would be gratefully received.

Is it possible that os.system and os.path.walk are being denied for
security reasons? After all, those functions can be set up to do
absolutely anything to your system, and giving access to them to a CGI
script is a major no-no from a security standpoint.

What exactly are you trying to do from your CGI script? You might want
to think about alternative ways of doing it. And especially if you're
handling any user-supplied data, think *long* and *hard* before passing
any user-suppied data as a parameter to something like os.system!

-- 
Robin Munn <rmunn at pobox.com>
http://www.rmunn.com/
PGP key ID: 0x6AFB6838    50FF 2478 CFFB 081A 8338  54F7 845D ACFD 6AFB 6838



More information about the Python-list mailing list