How to Fix 403 Error in XAMPP

Asked By 40 points N/A Posted on -
qa-featured

How can I resolve the 403 Forbidden Error in XAMPP? I have tried uninstalling and reinstalling XAMPP but I still have this problem. I'm using XAMPP 1.7.4 in Windows 7 64-bit.

SHARE
Best Answer by Graham Mcnatt
Answered By 0 points N/A #107146

How to Fix 403 Error in XAMPP

qa-featured

Error 403 has something to do with security. To fix this all you have to do is go to your XAMPP folder, go to apache-conf-extra and then open httpd-xampp.conf. Delete the code that's in there and replace it with the following code:

#
# XAMPP settings
#

<IfModule env_module>
    SetEnv MIBDIRS "C:/xampp/php/extras/mibs"
    SetEnv MYSQL_HOME "C:\xampp\mysql\bin"
    SetEnv OPENSSL_CONF "C:/xampp/apache/bin/openssl.cnf"
    SetEnv PHP_PEAR_SYSCONF_DIR "C:\xampp\php"
    SetEnv PHPRC "C:\xampp\php"
    SetEnv TMP "C:\xampp\tmp"
    UnsetEnv PERL5LIB
</IfModule>

#
# PHP-Module setup
#
LoadFile "C:/xampp/php/php5ts.dll"
LoadModule php5_module modules/php5apache2_2.dll

<IfModule php5_module>
    <FilesMatch ".php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch ".phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>

    PHPINIDir "C:/xampp/php"
</IfModule>

#
# PHP-CGI setup
#
<IfModule !php5_module>
    <FilesMatch ".php$">
        SetHandler application/x-httpd-php-cgi
    </FilesMatch>
    <IfModule actions_module>
        Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
    </IfModule>
</IfModule>


<IfModule mime_module>
    AddType text/html .php .phps
</IfModule>

ScriptAlias /php-cgi/ "C:/xampp/php/"
<Directory "C:/xampp/php">
    AllowOverride None
    Options None
    Order deny,allow
    Deny from all
    <Files "php-cgi.exe">
        Allow from all
    </Files>
</Directory>

<Directory "C:/xampp/cgi-bin">
    <FilesMatch ".php$">
        SetHandler cgi-script
    </FilesMatch>
    <FilesMatch ".phps$">
        SetHandler None
    </FilesMatch>
</Directory>

<Directory "C:/xampp/htdocs/xampp">
    <IfModule php5_module>
     <Files "status.php">
      php_admin_flag safe_mode off
     </Files>
    </IfModule>
    AllowOverride AuthConfig
</Directory>

<IfModule alias_module>
    Alias /security "C:/xampp/security/htdocs/"
    <Directory "C:/xampp/security/htdocs">
        <IfModule php5_module>
      <Files "xamppsecurity.php">
       php_admin_flag safe_mode off
      </Files>
        </IfModule>
        AllowOverride AuthConfig
   </Directory>

    Alias /licenses "C:/xampp/licenses/"
    <Directory "C:/xampp/licenses">
        Options +Indexes
        <IfModule autoindex_color_module>
            DirectoryIndexTextColor  "#000000"
            DirectoryIndexBGColor "#f8e8a0"
            DirectoryIndexLinkColor "#bb3902"
            DirectoryIndexVLinkColor "#bb3902"
            DirectoryIndexALinkColor "#bb3902"
        </IfModule>
   </Directory>

    Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
    <Directory "C:/xampp/phpMyAdmin">
        AllowOverride AuthConfig
    </Directory>

    Alias /webalizer "C:/xampp/webalizer/"
    <Directory "C:/xampp/webalizer">
        <IfModule php5_module>
      <Files "webalizer.php">
       php_admin_flag safe_mode off
      </Files>
        </IfModule>
        AllowOverride AuthConfig
    </Directory>
</IfModule>

#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    Allow from all
    Allow from All

    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>Ok


Save it and then Reboot Apache.

Best Answer
Best Answer
Answered By 0 points N/A #107148

How to Fix 403 Error in XAMPP

qa-featured

Hello!

Having an error 403 it means you’re having an error in directory, corrupted directory or the directory is not really exist. So to fix this problem, try my instruction bellow and see if this will work if not please let me know:

Step 1: Search then virtual host configuration file then launched it.


pico /etc/apache2/extra/httpd-vhosts.conf

Step 2: Find your virtual host definition, make sure that it was there if not you need to create it


<VirtualHost *:80>

ServerAdmin [email protected]
DocumentRoot "/Users/yourusername/Sites/mysite"
ServerName mysite.local
ErrorLog "/private/var/log/apache2/mysite-error_log"
CustomLog "/private/var/log/apache2/mysite-access_log" common 

</VirtualHost>


Step 3: Go to /etc/host file then you need to add the virtual host name like this:


##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1          localhost
255.255.255.255    broadcasthost
::1                localhost 
fe80::1%lo0        localhost


# VIRTUAL HOST START
127.0.0.1          localhost
127.0.0.1          mysite.local
# VIRTUAL HOST STOP

Step 4: You can now start the Apache and this must be successfully working


sudo apachectl restart

 

I hope this can help.

Login/Register to Answer

Related Questions