philc
January 6th, 2008, 03:29 PM
I'm a bit stuck regarding executing a bash command from a Perl script, using parameters input from a web form.
- I have installed Lighttpd on my machine.
- I have written an HTML file and saved it in /var/www
- I have written a Perl script and saved it in /usr/lib/cgi-bin
- The Perl script is chmod 755
- The owner of the Perl script and web form is myself.
The HTML file is a form. It loads fine in my browser at http://127.0.0.1/pagename.html
After entering data in the web form and submitting, the Perl script happily returns to the browser anything I have told it to "print". e.g. a success message and also an echo of the user input as variables - print "${variablename}"; - just to make sure the Perl variables are obtaining correct values from the form.
However, the whole aim of the Perl script is to take the user input from the web form and execute a bash command (file rename) based on that user input.
This is the bit that doesn't seem to work.
Executing the Perl script from the command line works fine if I manually add the variable values to the script - the file is renamed.
I'm guessing the problem is something to do with the web form/web server not having necessary permissions to bash commands, but I'm not sure how to investigate further.
Any pointers would be appreciated.
- I have installed Lighttpd on my machine.
- I have written an HTML file and saved it in /var/www
- I have written a Perl script and saved it in /usr/lib/cgi-bin
- The Perl script is chmod 755
- The owner of the Perl script and web form is myself.
The HTML file is a form. It loads fine in my browser at http://127.0.0.1/pagename.html
After entering data in the web form and submitting, the Perl script happily returns to the browser anything I have told it to "print". e.g. a success message and also an echo of the user input as variables - print "${variablename}"; - just to make sure the Perl variables are obtaining correct values from the form.
However, the whole aim of the Perl script is to take the user input from the web form and execute a bash command (file rename) based on that user input.
This is the bit that doesn't seem to work.
Executing the Perl script from the command line works fine if I manually add the variable values to the script - the file is renamed.
I'm guessing the problem is something to do with the web form/web server not having necessary permissions to bash commands, but I'm not sure how to investigate further.
Any pointers would be appreciated.