create a new directory from cgi script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting create a new directory from cgi script
# 1  
Old 03-03-2009
create a new directory from cgi script

hello.
i hav accepted name of directory from user through a form.now i need to create a directory under cgi-bin of that name.I am not able to do so.n help is required
# 2  
Old 03-03-2009
show us the relevant code with which you are trying to create the directory

what error do you see?
# 3  
Old 03-03-2009
i hav taken directory name from form and passed it to subroutine.I checked if directory name accepeted is correct or not by printin it.its correct.$_[0]->is my directory name
i hav used two lines below:

my $dir="/var/www/cgi-bin/"."$_[0]";
my $r=system('mkdir -p -m 755 $dir');

Directory is not being created. It shows no errors!
# 4  
Old 03-03-2009
try replacing this:
Code:
my $r=system('mkdir -p -m 755 $dir');

with this:
Code:
my $r=system("mkdir -p -m 755 $dir");

also, it would be good to (a) check the return status from the system call and (b) mention full path to mkdir
# 5  
Old 03-03-2009
1.i changed single quotes to double quotes.It din work.
2.I checked return status.It is 256.
3.Full path i hav specified.It din work.

One more thing:
When i ran a sample perl cgi script from terminal it created a directory .But wen run from form it did not.

Last edited by raksha.s; 03-03-2009 at 11:29 AM..
# 6  
Old 03-04-2009
apache is running with previledges of what user? (for example, user named nobody) check:
Code:
ps -ef | grep httpd

does user running apache have write permission for the directory in which you are trying to create a subdirectory?
# 7  
Old 03-04-2009
You may need to enable suexec to allow the script to create the directory. Suexec makes perl run as the user.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies

2. Shell Programming and Scripting

Unable to create spreadsheet in cgi script

hi folks, I am trying to download xlsx from cgi page in browser but not sure where I made a mistake. the cgi script contains the code for creating xlsx and just by clicking on the image I should be able to #!/usr/bin/perl -w use Excel::Writer::XLSX; use DBI; use DBD::mysql; use CGI;... (1 Reply)
Discussion started by: scriptscript
1 Replies

3. Shell Programming and Scripting

Can't create file in CGI Script

Hi I have some simple script within the context of a cgi script that create a file to write to. If I run the script from the command line as root the file is created with no issue. However when I run the script from a web page with the apache account, it dies. The code lines are: sub... (3 Replies)
Discussion started by: larryjmoon
3 Replies

4. Shell Programming and Scripting

Create download button using perl CGI

Hi, I want to insert in a page a .html button that - once it is clicked - opens a save file dialog box by using perl CGI . I know that to create a link to do that I've done : print $cgi->p ( { -class => 'linc' },);I want to do something similar for a download button (0 Replies)
Discussion started by: black_fender
0 Replies

5. Programming

CGI Perl script to execute bash script- unable to create folder

Hi I have a bash script which takes parameters sh /tmp/gdg.sh -b BASE-NAME -n 1 -s /source/data -p /dest/data/archive -m ARC gdg.sh will scan the /source/data and will move the contents to /dest/data/archive after passing through some filters. Its working superb from bash I have... (0 Replies)
Discussion started by: rakeshkumar
0 Replies

6. UNIX for Dummies Questions & Answers

create cgi-bin

Hello anyone, I'm a PHP programmer that, through work has to be a server administrator. We have a dedicated server at godaddy. I just found this forum but probably could have asked a thousand questions that I've already figured out. I tried finding anything online and would think this would... (0 Replies)
Discussion started by: Freddythunder
0 Replies

7. Homework & Coursework Questions

Create script to add user and create directory

first off let me introduce myself. My name is Eric and I am new to linux, I am taking an advanced linux administration class and we are tasked with creating a script to add new users that anyone can run, has to check for the existence of a directory. if the directory does not exist then it has... (12 Replies)
Discussion started by: pbhound
12 Replies

8. Shell Programming and Scripting

Help to create a Return Button using shell script CGI

Hello Guys, I would like to know how can I create a radio button on that its possible to return to the last page, using a ksh CGI shell script. Can someone help ? Thanks so much !!!:b: I tried this, but it is a javascript code ! <INPUT TYPE="button" VALUE="BACK" ... (2 Replies)
Discussion started by: robdcb
2 Replies

9. Shell Programming and Scripting

problem for CGI create Cookie!!!!

Hi Everyone, I am facing the problem to create the cookie in CGI (bash script). Is it possible can create in cgi? or javascript better? Anyone got the sample to create the cookie in cgi(bash script)? Just the login will do ->> USERNAME and PASSWORD after create how to store into the... (2 Replies)
Discussion started by: ryanW
2 Replies

10. Shell Programming and Scripting

CGI passing arrays/hashes to another CGI script

If I have a Perl CGI script (script01), which fills an array(s) with information and outputs a HTML page with a link to another CGI page (script02); is there anyway to pass the array(s) from "script01" to "script02" when the page visitor clicks the link? Hope that makes sense! :) (2 Replies)
Discussion started by: WIntellect
2 Replies
Login or Register to Ask a Question