Keep Server Online
  
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
  
or
  
 
  
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
  
Thank You! Steffen
  
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |    |   
 | 
     Topic: Internal server error - CGI/Perl | 
 |   
| Author | 
  | 
 
mrme01
 
 
  Joined: 07 Mar 2016 Posts: 2 Location: Nottingham, UK
  | 
 Posted: Mon 07 Mar '16 14:11    Post subject: Internal server error - CGI/Perl | 
     | 
 
  | 
 
Hi guys,
 
 
I'm having some issues with getting CGI to work, in the browser I get the above issue, in the logs I get  	  | Code: | 	 		  AH01215: (13)Permission denied: exec of '/var/www/html/test/perltest.cgi' failed
 
And
 
End of script output before headers: perltest.cgi | 	  
 
Regarding the permissions and directory structure, I have set up the Apache2 config to look like this
 
Apache2.conf
 
 	  | Code: | 	 		  
 
<Directory /var/www/>
 
   Options +Indexes +FollowSymLinks +ExecCGI
 
   AllowOverride None
 
   Order allow,deny
 
   Require all granted
 
   Allow from all
 
   AddHandler cgi-script .cgi
 
</Directory> | 	  
 
Sites available.conf
 
 
 	  | Code: | 	 		  
 
Alias /cgi-bin /var/www/
 
<Directory /var/www/>
 
AddHandler cgi-script cgi pl
 
Options ExecCGI
 
</Directory> | 	  
 
 
All permissions are set to www-data
 
perltest.cgi
 
 	  | Code: | 	 		  
 
#!/usr/local/bin/perl
 
 
print "Content-type: text/html\n\n";
 
print '<html>';
 
print '<head>';
 
print '<meta name="author" content="Kay Vogelgesang">';
 
print '<link href="/xampp/xampp.css" rel="stylesheet" type="text/css">';
 
print '</head>';
 
print "<body> <p><h1>GCI with MiniPerl</h1>";
 
print  "CGI with MiniPerl is ready ...</body></html>";
 
 | 	  
 
 
Any ideas? | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7443 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Tue 08 Mar '16 17:42    Post subject:  | 
     | 
 
  | 
 
| What is the chmod value of that file? Is it executeable? Is it saved with the correct line endings ( linux and not Windows) ? | 
 
  | 
 
| Back to top | 
 | 
 
mrme01
 
 
  Joined: 07 Mar 2016 Posts: 2 Location: Nottingham, UK
  | 
 Posted: Tue 08 Mar '16 23:46    Post subject:  | 
     | 
 
  | 
 
The box is currently off for upgrades, I'll check and report back once I have the box up and running.
 
 
The script was copied over from a Windows (xampp) install, how would I end the file accordingly? | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7443 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Wed 09 Mar '16 18:32    Post subject:  | 
     | 
 
  | 
 
The line endings
 
 
 	  | Code: | 	 		  
 
sed 's/^M$//' windows.txt > unix.txt
 
 | 	  
 
 
In doubt use chmod +x | 
 
  | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |