I am getting this error when I try executing a basic Perl script on my Apache server. In my browser, I type in localhost/cgi-bin/first.pl
, and I receive this error:
(13)Permission denied: exec of '/usr/lib/cgi-bin/first.pl' failed
This is my perl script:
#!/usr/lib/cgi-bin
print "Content-type: text/html\n\n";
print "Hello, World.";
And this is my default file in the sites-available
folder. As you can see, every file in /usr/lib/cgi-bin
should be recognized as a CGI file. And, /usr/lib/cgi-bin
is exactly where first.pl
is located.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AddHandler cgi-script .cgi .py
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
ALSO, I did do chmod a+x first.pl
.