Asked  7 Months ago    Answers:  5   Viewed   38 times

I know this question has been asked a lot of times

I followed Most of the answers in the internet But I still get the same Message

403 Forbidden

You don't have permission to access / on this server.

It is weird that when I access using the same PC to localhost:1234 it runs normally but if I access using my IP address 192.168.0.188:1234

Also which is really weird is that I tried to install WAMP on other PC and without any configuration I could access to that PC.

So I thought it's because McAfee and Firewall so I open port on Widows and McAfee and nothing changed also I turned off Firewall and still nothing change.

Then for no reason I opened port through the Router “port forwarding” and still nothing changed.

I don't think that it's because my configuration in WAMP since I am still able to get this 403 Forbidden Message and also by using other PC without any configuration I could access it.

Both PCs are setup like this:

Windows 8 Pro

  • WAMP Wampserver: 2.4
  • Apache Version: 2.4.4
  • PHP Version: 5.4.12
  • MySQL Version: 5.6.12

The accessible PC uses Microsoft Security Essentials.

The inaccessible PC uses McAfee Internet Security.

I tried to turn off WAMP and start IIS For Microsoft Server (I works perfectly From any PC) but WAMP is still not not working

I followed these tutorial:

  • How to Access WAMP Server in LAN or WAN
  • Install & Setup Virtual Host Guide for WAMP
  • Install & Setup LAN & Worldwide Access Guide for WAMP

And the Stack Overflow answers here:

  • Cannot access wamp server on local network
  • WAMP 403 Forbidden message on Windows 7

 Answers

93

If you are using WAMPServer 3 See bottom of answer

For WAMPServer versions <= 2.5

By default Wampserver comes configured as securely as it can, so Apache is set to only allow access from the machine running wamp. Afterall it is supposed to be a development server and not a live server.

Also there was a little error released with WAMPServer 2.4 where it used the old Apache 2.2 syntax instead of the new Apache 2.4 syntax for access rights.

You need to change the security setting on Apache to allow access from anywhere else, so edit your httpd.conf file.

Change this section from :

#   onlineoffline tag - don't remove
     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost

To :

#   onlineoffline tag - don't remove
    Require local
    Require ip 192.168.0

The Require local allows access from these ip's 127.0.0.1 & localhost & ::1.

The statement Require ip 192.168.0 will allow you to access the Apache server from any ip on your internal network. Also it will allow access using the server mechines actual ip address from the server machine, as you are trying to do.

WAMPServer 3 has a different method

In version 3 and > of WAMPServer there is a Virtual Hosts pre defined for localhost so you have to make the access privilage amendements in the Virtual Host definition config file

First dont amend the httpd.conf file at all, leave it as you found it.

Using the menus, edit the httpd-vhosts.conf file.

enter image description here

It should look like this :

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Amend it to

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Hopefully you will have created a Virtual Host for your project and not be using the wampwww folder for your site. In that case leave the localhost definition alone and make the change only to your Virtual Host.

Dont forget to restart Apache after making this change

Wednesday, March 31, 2021
 
mozlima
answered 7 Months ago
53

Ok I found the solution, may someone find it useful.

$user='root';
$pass='mypassword';
$host='localhost';

$cmd='e:wampbinmysqlmysql5.6.12binmysqldump --user='.$user.' --password='.$pass .' --host=localhost hospitalerp > db_backup4.sql';
//var_dump($cmd);exit;
exec($cmd, $output, $return);
if ($return != 0) { //0 is ok
    die('Error: ' . implode("rn", $output));
}

echo "dump complete";
Wednesday, March 31, 2021
 
radmen
answered 7 Months ago
73

Important:

Please change the version number to get more security if you have phpMyAdmin exposed to the public or need features from newer phpMyAdmin versions.

This was taken from a chat. Some things might be inaccurate, but this solved the OP's problem

Install PHPMyAdmin using the following tutorial:

1.

apt purge phpmyadmin -y
cd /path/to/somefolder
wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0-rc1/phpMyAdmin-5.1.0-rc1-all-languages.zip && unzip phpMyAdmin-5.1.0-rc1-all-languages.zip && 
cd phpMyAdmin-5.1.0-rc1-all-languages
apt install pwgen -y
  1. Make note of the output of this command, I will refer to it as pw
pwgen -s 32 1
cp config.sample.inc.php config.inc.php
  1. Edit config.inc.php with favorite editor, and paste the pw in this line:
. . .
$cfg['blowfish_secret'] = 'STRINGOFTHIRTYTWORANDOMCHARACTERS'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
. . .
vim /etc/apache2/conf-available/phpmyadmin-custom.conf
  1. Paste the following to that previous command:
Alias /phpmyadmin /path/to/that/phpMyAdmin-5.1.0-rc1-all-languages
<Directory "/path/to/that/phpMyAdmin-5.1.0-rc1-all-languages">
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
Require all granted
</Directory>
  1. Save the previous one using :wq, Run the following command
a2enconf phpmyadmin-custom && systemctl restart apache2 && mysql
  1. Replace your_password_here to your own password.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password_here';
systemctl restart mysql

It should work now.

Additional notes:

To only allow you to view phpMyAdmin, try:

<Directory "/path/to/that/phpMyAdmin-5.1.0-rc1-all-languages">
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
Require local
# Or change it to
# Require ip 127.0.0.1
# change 127.0.0.1 to your personal computers ip address,
# not to the server ip
# if you want to access phpMyAdmin from a public server, but not allow others to access it
</Directory>
Friday, May 28, 2021
 
Gilko
answered 5 Months ago
91

Try running the server on port 80 instead, your firewall is probably blocking port 3000.

Tuesday, July 27, 2021
 
dmp
answered 3 Months ago
dmp
73

You've made the simplest of mistakes, Which is okay.. If you don't own Notepad ++ then I suggest you do. If you have Notepad ++ open those files again and do CTRL + F then go to the replace tab and put in the Find What put "Require all denied" and replace with "Require all granted".

Also do the same with the phpmyadmin file do the CTRL + F then go to the replace tab then find what "deny from all" and replace with "allow from all" make sure you save both files by clicking the blue save icon toward the top of the program then left click wampserver and restart all services and try again. As long as you change that you should have access to your entire server. I don't suggest you mess with vhosts unless you need to. For example PHPMyAdmin you can deny it from any source but local then allow something like SMF or WordPress without having to change other settings.

Tuesday, August 24, 2021
 
Kemrop
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share