I've got a CGI script that executes a really intensive Java application:

start.cgi
#!/bin/sh
cd /var/server/; screen -d -m java -Xmx800M -Xms800M -jar jarfile.jar > /dev/null 2>&1 &
echo "Server command executed.";

This executes all right by moving into it within an web browser and thru an SSH session.

However when run by moving into it by having an web browser, it appears to operate underneath the apache process... Creation of top:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7651 apache 24 0 1149m 38m 9012 S 0.0 2.5 0:01.42 java

When run with an SSH session top results:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7685 root 23 0 1163m 205m 9432 S 12.3 13.6 0:06.03 java

In my opinion the CGI script is running underneath the apache process...
Can someone please explain things i did wrong or point me within the right direction?

Thanks!
Justin

You might want to chmod your script file to create the uid as root - but I'd need to state that that's not a good idea. It is possible to issue in the job running as apache instead of root? Surely the only real reason why it runs as root from an ssh session happens because you've drenched in as root?