Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile system() in CGI doesn't work

    I use apache to make web server, in /cgi-bin/ I made a test.cgi.
    there are some code like the following:

    system ("chown apache.apache /cgi-bin/enm");
    system ("chmod 777 /cgi-bin/enm");
    system ("chmod 777 /cgi-bin/enm/*");
    system "sh /var/www/cgi-bin/enm/run.bat";

    I already give permission to /cgi-bin, but it seems system does't do anything.
    However if I run sh /var/www/cgi-bin/enm/run.bat in command line, it works.
    I am working on linux.

    Could anyone help me.

    jlf

  • #2
    New Coder MetalGear's Avatar
    Join Date
    Feb 2008
    Location
    Jambudvipa
    Posts
    56
    Thanks
    6
    Thanked 1 Time in 1 Post

  • #3
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,840
    Thanks
    2
    Thanked 160 Times in 155 Posts
    Why are you using system calls to chown and chmod when Perl has those commands built-in?

    Why are you setting the permissions to 777? That opens up security concerns.

    Why are you using a system call to execute run.bat when Perl can run it directly?

    Where's your error handling?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •