4

I am very new to xampp. I have made a fresh xampp install with the following commands.

sudo su
cd /tmp
wget bit.ly/1cmyrUo -O xampp-32bit.run
chmod 777 ./xampp-32bit.run
sudo ./xampp-32bit.run

Then I made a perl file to check whether my xampp works. The following is my sample.pl file content.

#!usr/bin/perl
print "content-type:text/html\n";
print(header());
use CGI qw(:standard);
print(start_html());
print "Hello. I am ram";
print(end_html());

After copying my perl file from /home/vicky/desktop to /opt/lampp/cgi-bin.

I started my xampp with the following command.

/opt/lampp/lampp start

Then I ran my sample.pl in the localhost with the help of the http://localhost/cgi-bin/sample.pl in my mozilla browser. I just got the following window. Error 403 window

I found only answers relating to the 'new security concept error' and 'accessing virtual host issue'.

I did came across an askubuntu query, a bid similar to that of mine. It had no answers but some comments. One comment suggested to change the file permissions. It directed to get help from here.

It said to change the directory permission as 755 and file permission as 644 to resolve this kind of issue. When I tried to do that, I came to know that my cgi-bin directory already had 755 permission and my sample.pl had 644 permission. I have no solutions now.


PostScript: I have attached the content of my /opt/lampp/apache2/conf/httpd.conf file. Hope this will help the answer-providers to understand my problem completely.

Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"

<Directory "/opt/lampp/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory> 
Ramvignesh
  • 1,812
  • 6
  • 20
  • 31
  • I'd suggest using sudo apt-get install lamp-server^ instead of installing xampp manually. – kraxor Jul 29 '14 at 20:44
  • 403 forbidden means that your are not allow to access that page. Could you post your apache configuration? Also try this link – Lety Jul 29 '14 at 23:08
  • @Letizia: Where is my apache configuration? – Ramvignesh Jul 30 '14 at 05:30
  • @Ranviqnesh: should be in the directory /your/path/xampp/apache/conf – Lety Jul 30 '14 at 08:14
  • Did you post the entire file or only a portion? Could you check if there are other file in /opt/lampp/apache2/conf or in /opt/lampp/apache2/sites-available. If you find 00-default.conf, could you post its content? You could use pastebin. – Lety Jul 30 '14 at 20:41
  • @Letizia: Yes. I did had just this much in my httpd.conf file. Then, I don't have sites-available. As well, I don't have 00-default.conf anywhere. – Ramvignesh Jul 30 '14 at 23:17

4 Answers4

2

As I can see in your question, you are using Apache 2.4.7, but your httpd.conf use Apache 2.2 directive.

According to Apache 2.4 manual:

Access control

In 2.2, access control based on client hostname, IP address, and other characteristics of client requests was done using the directives Order, Allow, Deny, and Satisfy.

In 2.4, such access control is done in the same way as other authorization checks, using the new module mod_authz_host. The old access control idioms should be replaced by the new authentication mechanisms, although for compatibility with old configurations, the new module mod_access_compat is provided.

Try this changes:

<Directory "/opt/lampp/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory> 

Allow and deny directive controls which hosts can or can't access an area of the server, Require tests whether an authenticated user is authorized according to a particular authorization provider and the specified restrictions. Require all granted means access is allowed unconditionally, let see Beyond just authorization

Update after reading configuration file:

Your default configuration file is right. The problem is wrong shebang in perl script.

Try this:

  #!/usr/bin/perl

Also:

  chmod +x /opt/lampp/cgi-bin/yourScript.pl

Here is a useful link about file permission problem

Second update

Change http content header:

  print "Content-type:text/html\n";

This header is read by apache.

You apache is running as daemon user, check if each directory in script path are readable.

Lety
  • 6,039
  • 2
  • 29
  • 37
  • New changes does show the same error message! – Ramvignesh Jul 31 '14 at 23:58
  • So there must be other configuration files, is there /opt/lampp/etc/extra/httpd-xampp.conf file? Try find /opt/lampp -name "*.conf" and check if these file are apache conf file – Lety Aug 01 '14 at 07:58
  • I have found /opt/lampp/etc/extra/httpd-xampp.conf. But there is no <Directory "/opt/lampp/apache2/htdocs"> section. I have attached my httpd-xampp.conf file here. Please see through it. – Ramvignesh Aug 03 '14 at 09:12
  • @Ramviqnesh: okey, this file is a part of configuration, I think that there are other file, in any case, did you get same error if you try to access a simple index.php at http://localhost? – Lety Aug 06 '14 at 09:09
  • It is not showing any error. When I enter http://localhost/index.php, the url turns into http://localhost/xampp/. Then, the XAMPP for Linux page is getting opened. – Ramvignesh Aug 22 '14 at 15:20
  • Thi means that there is an http redirection. It is necessary find out the main apache configuration file. Try this command: 'find /opt/lampp -name "*.conf" -exec grep DocumentRoot {} ; -print' – Lety Aug 22 '14 at 17:27
  • I have tried find /opt/lampp -name "*.conf" -exec grep DocumentRoot {} \; -print. And I have pasted its result here. Please look through it. – Ramvignesh Aug 22 '14 at 23:35
  • Could you post: /opt/lampp/etc/httpd.conf and /opt/lampp/etc/extra/httpd-vhosts.conf? And also "ls /opt/lampp/etc /opt/lampp/etc/extra" output. – Lety Aug 23 '14 at 09:01
  • Updeted answer, sorry, I have not noticed before – Lety Aug 24 '14 at 10:52
  • Changed my shebang and done +x to the file permissions. Still I find the 403 error. – Ramvignesh Aug 24 '14 at 13:01
  • Updated answer, if it will not work again, check if perl script print a well formed html output and please post /opt/lampp/etc/extra/httpd-default.conf, /opt/lampp/etc/extra/proxy-html.conf and /opt/lampp/etc/extra/httpd-xampp.conf – Lety Aug 24 '14 at 21:26
  • @Ramvignesh, I'm curious, did you finally resolve the issue? – Lety Aug 27 '14 at 12:41
  • Sorry ya. My brother mistakenly overwritten my ubuntu os with a windows 8. I have installed a new copy of ubuntu now. need to install xampp again. – Ramvignesh Aug 28 '14 at 11:52
  • When I installed xampp last time, I did it this way. Shall do the same now ? – Ramvignesh Aug 28 '14 at 11:59
  • Sorry, but I don't know, If you need help on how is the best way to install xampp, try to ask an other question, someone else will help you for sure. – Lety Aug 28 '14 at 16:51
0

To solve this problem,you should upgrade xampp to last version

And Run apache again it will run correctly.

Eng_Farghly
  • 101
  • 2
0

Try changing owner and group for the files to apache,

In ubuntu the apache user is www-data, in terminal:

$ sudo chown -R www-data:www-data PUBLICFOLDER

And refresh the browser.

elgastelum
  • 129
  • 1
  • 8
-1
$ cd /opt/lampp
$ sudo chmod 777 -R htdocs

And edit httpd.conf (with something like sudoedit /opt/lampp/etc/httpd.conf) and change:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

To:

<Directory "/opt/lampp/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
Oli
  • 293,335
  • and configure--> httpd.conf

    <Directory "/opt/lampp/apache2/htdocs"> Options Indexes FollowSymLinks AllowOverride All Require all granted

    – Nhat Nguyen Mar 31 '16 at 09:30
  • Allowing read+write+execute to every user is a bad idea. – Oli Mar 31 '16 at 10:52