Apache not executing script!! help required soon

i need to know all possible reasons for apache not able to execute a command on server side script.
I have a cgi script that calls a shell script .This shell script calls a perl script which has commnad in it.
Ths command is not getting executed from gui.The return status of shell script is 256.
The command is of type:
`/path/xxx > /path/t.log`;
Here in the t.log log file i can see:
sh:xxx: permission denied
but the all scripts have 777 permission,
even command script has 777 permission.
But from terminal evrything is working fine.
Even other functions from the gui are working fine except this function.

Have you check the /path owner and permision? Is it allow the apache httpd's owner to access and execute the file?
Some how, the file is allow for all user but the folder is not allow the other group or user to access.

give the apache user a shell in /etc/passwd, su to apache-user and try to execute the script manually

don't forget to remove the shell afterwards

how do i do that?can you please give me an example

all folders have 777 permissions..

how to do that?please give me an exmaple

edit /etc/passwd, or use the command

usermod -s /bin/bash apache 

su - apache

cd to the path the perl script is in

cd /path/

./perlscript.pl

see if it's executable,

then

usermod -s /sbin/nologin apache

perhaps you have to specify hardcoded variables in the script, depends on what you are doing with it, you don't want to destroy something I guess

apache username and path of /sbin/nologin may differ on your system

yes,i did wat u said,It worked.But from browser the same cgi script is not working!!!!

Hi. raksha.s

To find the process owner. In solaris, it generally use 'ps -ef ' command to list all current process.
In other Unix system use "ps -aux" instead.
However, If your system has long list of process you can use "ps -ef | more" to watch it page by page.
I have a simple script for you to find who is the owner of the httpd process as below.
$ pgrep -f httpd | xargs -t -I {} ps -fp {} | cut -d" " -f1

The pgrep -f will fetch the httpds process id. The xargs prepare the output from pgrep as the agruments for ps command. The cut command with -d (delimiter) " " (space) give you the first column (user id) from PS command.

For the apache it is, for security, usually running by "nobody" to get the lowest privilege. So, that why I ask you to check the httpd owner.

About the cgi script, I hope you have already check that the second script that called by the first script is also permitted.

Hope you can find the break point soon.

if the apache user, is able to execute the script, there must be something wrong with your cgi-bin directory

try to create a script test.cgi

#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<strong>test</strong>"

chown apache:apache test.cgi

move it to the cgi-bin directory

open it with a browser, page should show the string "test" in bold

Edit: don't forget chmod +x test.cgi