cancel
Showing results for 
Search instead for 
Did you mean: 

unable to get a cgi script to run

flyer99
Grafter
Posts: 70
Registered: ‎18-05-2007

unable to get a cgi script to run

Hi
Its been a while since i used by cgi space and we no longer have SSH access to the command line. Reading other post i should be able to write and run a script
I am trying to unzip a tar file but always get an error message
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: test99.cgi
followed a server 500 message
The script is
#!/bin/bash
echo "Content-type: text/plain"
echo
tar -xvvzf joomla.tar.gz
the script is in the same folder as the file. Can anyone help me here as i unable to sort this one out
Thanks
Nick
5 REPLIES 5
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,370
Fixes: 75
Registered: ‎06-04-2007

Re: unable to get a cgi script to run

Have you set permissions (chmod) on test99.cgi to 0700?
David
flyer99
Grafter
Posts: 70
Registered: ‎18-05-2007

Re: unable to get a cgi script to run

Quote from: spraxyt
Have you set permissions (chmod) on test99.cgi to 0700?

I believe so
-rwx------  1 xxxxxxcgiusers      76  May  6 20:35  test99.cgi
Regards
Nick
flyer99
Grafter
Posts: 70
Registered: ‎18-05-2007

Re: unable to get a cgi script to run

OK
seems i finally resolved the issue. I uploaded a ZIP version as opposed to TAR and used the following script
<?php
exec('unzip Joomla_1.5.17-Stable-Full_Package.zip',$ret);
?>
I ran this script to see what is available
<?php
foreach ( array('tar','gtar','unzip','gunzip') as $bin) {
  exec ("whereis $bin", $ret);
print join(', ', $ret).'<br>';
}
?>
results as follows
tar: /bin/tar /usr/share/man/man1/tar.1.gz
tar: /bin/tar /usr/share/man/man1/tar.1.gz, gtar:
tar: /bin/tar /usr/share/man/man1/tar.1.gz, gtar:, unzip: /usr/bin/unzip /usr/share/man/man1/unzip.1.gz
tar: /bin/tar /usr/share/man/man1/tar.1.gz, gtar:, unzip: /usr/bin/unzip /usr/share/man/man1/unzip.1.gz, gunzip: /bin/gunzip /usr/share/man/man1/gunzip.1.gz
I deduced from this that tar and gtar are unavailable and we have ZIP or GUNZIP
Am I correct in my theory?
Anyway issue resolved
Nick
Ben_Brown
Grafter
Posts: 2,839
Registered: ‎13-06-2007

Re: unable to get a cgi script to run

tar, unzip and gunzip are available, paths are given for them in your script output.
tar on ccgi is gtar, it's just not called gtar. You'd not normally find gtar called gtar on linux systems, however it's common on Solaris and BSD based systems.
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,370
Fixes: 75
Registered: ‎06-04-2007

Re: unable to get a cgi script to run

Using a test directory I created a tar file using 'tar -cvvzf filename.gz dirname', listed it using 'tar -tvvzf filename.gz' and extracted it using 'tar -xvvzf filename.gz' without problems. So I wonder if the original joomla file might have been damaged?
I had wondered if the very-verbose option was causing problems, but it proved not to be. However a single 'v' is sufficient.
David