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

    Reading & writting a file in perl/cgi and executing it in apache webbrowser

    hi every body,

    I am trying to execute system command and open a file to read and right in apache web browser using perl/cgi scripting and the code is as follows.

    print "Content-type:text/html\n\n";
    @var=`ls -tr /var/lib/php/session/`;
    open(FILE,"/var/lib/php/session/$var[$#var]") or die $!;
    print "File Name :: @var <br>";
    print "File Name: $filename <br>";
    If i execute the above code in normal perl program i mean perl <filename> it's executing without any error but if i am trying to execute through apache web browser i am getting the following error in http errorlog

    [Thu Aug 13 11:28:57 2009] [error] [client] ls:
    [Thu Aug 13 11:28:57 2009] [error] [client] /var/lib/php/session/
    [Thu Aug 13 11:28:57 2009] [error] [client] : Permission denied
    [Thu Aug 13 11:28:57 2009] [error] [client]
    [Thu Aug 13 11:28:57 2009] [error] [client] Permission denied at /var/www/cgi-bin/kkkkk.pl line 4.

    and in browser it showing 512 error for the system command any idea about this error.

    Thank in advance.

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Thanked 163 Times in 160 Posts
    does the user that apache is running as have execute privileges on that directory?
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow


    Posting Permissions

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