Error 403. Wamp Server - wampserver

I have installed wamp server 2.2
I'm using windows 7
When I am online at that time i'm not able to find localhost using WaMp
its giving me some Forbidden Error..You Don't have Access kind of error.
But when I disconnect my internet connection, I can get localhost..PHPmyadmin and all feature of WAMP server.
I tried a lot by changing the Apache httpd .conf to Replace All..."Deny all" to "Allow all"but still, i'm not able to get it online.

Putting server online in contect menu did not help me. If you are using Wamp server 2.2E you will find the lines in your httpd.conf file
# onlineoffline tag - don't remove
Require local
Change them to to
# onlineoffline tag - don't remove
Require all granted
This solved my problem.

Cut and paste:
Error 403 Forbidden with phpmyadmin and WAMP Server
Error 403
-----
Forbidden
You do not have permission to access / on this server.
Edit the Apache configuration file httpd.conf and find the lines:
# onlineoffline tag - don't remove
Order deny, allow
Deny from all
Allow from 127.0.0.1
Change them to:
Order allow, deny
Allow from all
It works.

You can change 127.0.0.1 to ::1 or change Deny from all to Allow from all in the httpd.conf file. I have a blog about this error on Windows 8 at http://www.webtrunghieu.info/site?p=21

You may also have a .htaccess file within your www directory which is causing this error. Be sure to check that.

Go to C:/Windows/System32/drivers/etc/host
find the
"#127.0.0.1 localhost"
line and uncomment it by removing the # sign
It is possible that you get an 'access denied' message even when you are logged in as an administrator.
To work around that, right click on your file editing software and click run as administrator.
You should be able to save the file then
Localhost should work just fine after that.

I tried solutions posted here, but did not work to get wamp 2.2 started on windows 8 machine. This link from wamp server forum solved issue. I needed to change "Listen 80" to "Listen 0.0.0.0:80" in httpd.conf file. This may be an issue specific to my machine but the solution worked like a charm.

just need put your wampserver online
in tray right-click on wamp icon and Put Online

Related

Wamp server 2.5 wrong page redirection

I installed wamp server 2.5 with PHP 5.5. Now, when i try to access my project pages from the front page(wamp home page), it redirect to a wrong url and shows google cannot find this page.
The problem definition is
I enter to wamp using http://localhost
There I have many project. Suppose I click on sample_project
Then the page redirects to sample_projects/
And Google Chrome displays the error chrome cannot find this webpage
There are two fields are swown red marks in my wamp PHP extensions area. They are php_enchant and php_opcache
What is the problem with my wamp??am I missing something? Help please
Honestly I think its highly inefficient to create Virtual Host for every.. single.. project. So after investigating I found a key variable in:
wamp/www/index.php.
After quick analysis, the variable's obvious purpose is to remove the 'localhost' in projects links.
Change this line:
$suppress_localhost = true;
To this:
$suppress_localhost = false;
WAMPServer 2.5 Homepage the Your Projects Menu and Virtual Hosts
There has been a change of concept in WampServer 2.5 and there is a good reason for this change!
In WampServer 2.5 it is now STRONGLY encouraged to create a Virtual Host for each of your projects, even if you hold then in a \wamp\www\subfolder structure.
Virtual Hosts Documentation
Virtual Host Examples
The WampServer home page ( \wamp\www\index.php ) now expects you to have created a Virtual Host for all your projects and will therefore work properly only if you do so.
History
In order to make life easier for beginners using WampServer to learn PHP Apache and MySQL it was suggested that you create subfolders under the \wamp\www\ folder.
wamp
|-- www
|-- Chapter1
|-- Chapter2
|-- etc
These subfolders would then show as links in the WampServer Homepage under a menu called 'Your Projects' and these links would contain a link to localhost/subfoldername.
Acceptable only for simple tutorials
This made life easy for the complete beginner, and was perfectly acceptable for example for those following tutorials to learn PHP coding.
However it was never intended for use when developing a real web site that you would later want to copy to your live hosted server.
In fact if you did use this mechanism it often caused problems as the live sites configuration would not match your development configuration.
The Problem for real website development.
The reason for this is of course that the default DocumentRoot setting for wamp is
DocumentRoot "c:/wamp/www/"
regardless of what your subfolder was called.
This ment that often used PHP code that queried the structure or your site received different information when running on your development WampServer to what it would receive when running on a live hosted server, where the DocumentRoot configuration points to the folder at the top of the website file hierarchy.
This kind of code exists in many frameworks and CMS's for example WordPress and Joomla etc.
For Example
Lets say we have a project called project1 held in wamp\www\project1 and run incorrectly as localhost/project1/index.php
This is what would be reported by some of the PHP command in question:
$_SERVER['HTTP_HOST'] = localhost
$_SERVER['SERVER_NAME'] = localhost
$_SERVER['DOCUMENT_ROOT'] = c:/wamp/www
Now if we had correctly defined that site using a Virtual Host definition and ran it as http://project1 the results on the WAMPServer devlopment site will match those received when on a live hosted environment.
$_SERVER['HTTP_HOST'] = project1
$_SERVER['SERVER_NAME'] = project1
$_SERVER['DOCUMENT_ROOT'] = c:/wamp/www/project1
Now this difference may seem trivial at first but if you were to use a framework like WordPress or one of the CMS's like Joomla for example, this can and does cause problems when you move your site to a live server.
How to create a Virtual Host in WampServer
Actually this should work basically the same for any wndows Apache server, with differences only in where you may find the Apache config files.
There are 3 steps to create your first Virtual Host in Apache, and only 2 if you already have one defined.
Create the Virtual Host definition(s)
Add your new domain name to the HOSTS file.
Uncomment the line in httpd.conf that includes the Virtual Hosts definition file.
Step 1, Create the Virtual Host definition(s)
Edit the file called httpd-hosts.conf which for WampServer lives in
\wamp\bin\apache\apache2.4.9\conf\extra\httpd-hosts.conf
(Apache version numbers may differ, engage brain before continuing)
If this is the first time you edit this file, remove the default example code, it is of no use.
I am assuming we want to create a definition for a site called project1 that lives in
\wamp\www\project1
Very important, first we must make sure that localhost still works so that is the first VHOST definition we will put in this file.
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
Now we define our project: and this of course you do for each of your projects as you start a new one.
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/project1"
ServerName project1
<Directory "c:/wamp/www/project1">
AllowOverride All
Require local
</Directory>
</VirtualHost>
NOTE: That each Virtual Host as its own DocumentRoot defined. There are also many other parameters you can add to a Virtual Hosts definition, check the Apache documentation.
Small aside
The way virtual hosts work in Apache: The first definition in this file will also be the default site, so should the domain name used in the browser not match any actually defined virtually hosted domain, making localhost the first domain in the file will therefore make it the site that is loaded if a hack attempt just uses your IP Address.
So if we ensure that the Apache security for this domain is ALWAYS SET TO
Require local
any casual hack from an external address will receive an error and not get into your PC, but should you misspell a domain you will be shown the WampServer homepage, because you are on the same PC as WampServer and therfore local.
Setp 2:
Add your new domain name to the HOSTS file.
Now we need to add the domain name that we have used in the Virtual Host definition to the HOSTS file so that windows knows where to find it. This is similiar to creating a DNS A record, but it is only visible in this case on this specific PC.
Edit C:\windows\system32\drivers\etc\hosts
The file has no extension and should remain that way. Watch out for notepad, as it may try and add a .txt extension if you have no better editor.
I suggest you download Notepad++, its free and a very good editor.
Also this is a protected file so you must edit it with administrator privileges, so launch you editor using the Run as Administrator menu option.
The hosts file should look like this when you have completed these edits
127.0.0.1 localhost
127.0.0.1 project1
::1 localhost
::1 project1
Note that you should have definitions in here for the IPV4 loopback address 127.0.0.1 and also the IPV6 loopback address ::1 as Apache is now IPV6 aware and the browser will use either IPV4 or IPV6 or both. I have no idea how it decides which to use, but it can use either if you have the IPV6 stack turned on, and most window OS's do as of XP SP3.
Now we must tell windows to refresh its domain name cache, so launch a command window again using the Run as Administrator menu option again, and do the following.
net stop dnscache
net start dnscache
This forces windows to clear its domain name cache and reload it, in reloading it will re-read the HOSTS file so now it knows about the domain project1.
Step 3: Uncomment the line in httpd.conf that includes the Virtual Hosts definition file.
Edit your httpd.conf, use the wampmanager.exe menus to make sure you edit the correct file.
Find this line in httpd.conf
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
And just remove the # to uncomment that line.
To activate this change in you running Apache we must now stop and restart the Apache service.
wampmanager.exe -> Apache -> Service -> Restart Service
Now if the WAMP icon in the system tray does not go GREEN again, it means you have probably done something wrong in the \wamp\bin\apache\apache2.4.9\conf\extra\httpd-hosts.conf file.
If so here is a useful mechanism to find out what is wrong. It uses a feature of the Apache exe (httpd.exe) to check its config files and report errors by filename and line numbers.
Launch a command window.
cd \wamp\bin\apache\apache2.4.9\bin
httpd -t
So fix the errors and retest again until you get the output
Syntax OK
Now there is one more thing.
There are actually 2 new menu items on the wampmanager menu system. One called [b]'My Projects'[/b] which is turned on by default.
And a second one, called [b]'My Virtual Hosts'[/b], which is not activated by default.
'My Projects' will list any sub directory of the \wamp\www directory and provide a link to launch the site in that sub directory.
As I said earlier, it launches 'project1` and not 'localhost/project1' so to make the link work we must create a Virtual Host definition to make this link actually launch that site in your browser, without the Virtual Host definition it's likely to launch a web search for the site name as a keyword or just return a site not found condition.
The 'My Virtual Hosts' menu item is a little different. It searches the file that is used to define Virtual Hosts ( we will get to that in a minute ) and creates menu links for each ServerName parameter it finds and creates a menu item for each one.
This may seem a little confusing as once we create a Virtual Host definition for the sub directories of the \wamp\www folder some items will appear on both of the 'My Projects' menu and the 'My Virtual Hosts' menu's.
How do I turn this other 'My Virtual Hosts' menu on?
Make a backup of the \wamp\wampmanager.tpl file, just in case you make a mistake, its a very important file.
Edit the \wamp\wampmanager.tpl
Find this parameter ;WAMPPROJECTSUBMENU, its in the '[Menu.Left]' section.
Add this new parameter ;WAMPVHOSTSUBMENU either before or after the ;WAMPPROJECTSUBMENU parameter.
Save the file.
Now right click the wampmanager icon, and select 'Refresh'. If this does not add the menu, 'exit' and restart wampmanager.
Big Note
The new menu will only appear if you already have some Virtual Hosts defined! Otherwise you will see no difference until you define a VHOST.
I can't believe that Wampserver now expects everyone to create a virtual host for every project under development offline on their laptops?
Your instructions seem to be very good but probably much too complicated for beginners (also, I suspect that the file path in your instructions for step2: adding the new domain to the HOSTS file only applies to 32-bit Windows)?
The solution from Rogue above (change $suppress_localhost="true"; to $suppress_localhost="false"; in c:/wamp/www/index.php) will work perfectly for 99% of the users who develop more than one website on their laptops.
Also uploading a completed website to an online server should not cause any real problems.
BUt perhaps Wampserver had another reason for adding the $suppress_localhost code?

Issue on Redirecting Projects on WampServer Index Page

Using WampServer 2.5 on Windows 7 Ultimate 64 bit I am not able to redirect from Wamp index page to Projects URL. For example, I have a Project called "Proj 1" which listed under "Your Projects" but when I click on that the address bar only change to
Proj 1
and I get this error message on page Oops! Google Chrome could not find Proj 1
and when I add localhost/ to the URL inbox it works fine. I tried to re install the Wamp several times but it didn't fix the issue.
Can you please let me know why this is happening and how I can fix this?
The QUICK AND DIRTY way to revert back to the old way and undo this new INTENDED functionality is:-
Edit \wamp\index.php
Find this line at aprox line 34
$suppress_localhost = true;
And change it to
$suppress_localhost = false;
CORRECT Solution
Is to create a VirtualHost for each of your projects that you want to store under the \wamp\www\ folder. Or anywhere else for that matter.
Edit the file \wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
change version number to match your installed version of apache
Remove its default contents and add this to define your first VirtualHost definition
<VirtualHost *:80>
ServerName proj1
DocumentRoot C:/wamp/www/proj1
<Directory "C:/wamp/www/proj1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
</VirtualHost>
Save it!
Now edit the httpd.conf file ( using the wampmanager menu links ) and uncomment the line that includes the file we have just changed.
Find
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
And remove the # comment character like so :-
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Now edit the HOSTS file C:\windows\system32\drivers\etc\hosts and add a new line to tell windows that there is a site called proj1 so it should end up looking like this :-
127.0.0.1 localhost
::1 localhost
127.0.0.1 proj1
::1 proj1
Remember you have to be an Administrator to edit the hosts file!!! Hit the Windows key, type note, right click on Notepad and choose Run as Administrator.
Now to apply that change to the HOSTS file either reboot or
Start a command window using "Run as Administrator" and run these 2 commands :-
net stop Dnscache
net start Dnscache
This will refresh the windows DNS cache, and you new site will be addressable.
Now last of all restart the Apache service so it picks up your new VirtualHost definition.
wampmanager -> Apache -> Service -> Restart service
PS: Remove the space from the "proj 1" folder name. Spaces can cause odd issues. Remember Apache was ported from Unix and Unix does not really like spaces in directory names.
One option could be updating the www index.php (Line 338) from
$projectContents .= '<li>'.$file.'</li>';
to
$projectContents .= '<li>'.$file.'</li>';

wamp server locally denied?

I have just installed Wamp Server 2 to my pc. and I cannot access phpmyadmin, or even index.php at root directory, it all gives 403 Forbidden.
I have also tried to change permission from alias.conf it did not work.
Do you have any idea how to solve this, or any offer is worth to try, please share.
Thanks in advance.
PS: OS: W7, antivirus KasperSky, windows firewall off.
EDIT: restarting wamp solved phpmyadmin access but directory access (ie: http://localhost/index.php) is still forbidden.
EDIT2: I can now access my index.php through the url: 127.0.0.1/index.php but I cannot still access http://localhost/index.php and I shall use http://localhost/
EDIT3: Logs are full of :
[Fri Apr 13 20:50:06 2012] [error] [client ::1] client denied by server configuration: C:/wamp/www/
[Fri Apr 13 20:50:19 2012] [error] [client ::1] client denied by server configuration: C:/wamp/www/
See my old guide here, many of my friend has this error and this guide works http://www.hieule.info/site/web/solve-the-denied-access-problem-when-using-wamp-server-2-on-windows-8- Hope this works for you too.
I'm planning to use wampserver on windows 8 to run a local only server. I fixed this problem by editing Apache httpd.conf like Trung-Hieu Le (cf.), but only changed one line :
Change
Listen 80
To
Listen 127.0.0.1:80
#Listen 80
This problem with apache configuration. Go to httpd.cong file and replace line number 46 to Listen 127.0.0.1:80. This worked for me.
If it was a firewall problem, you wouldn't even get a 403 error, you'd just get "site is unreachable" from your browser. Check the server error log, it'll explain exactly why it you're getting the error.
I'm guessing it's due to a mis-configured default document with directory browsing disabled - e.g. you've got an index.php in there, but Apache's only looking for index.html by default. With directory browser disabled, you'll get a 403 Forbidden.
chnage localhost to 127.0.0.1 and should work , i had smiler problem :)
::1 - - [11/Nov/2012:14:29:34 +0330] "GET / HTTP/1.1" 403 202
127.0.0.1 - - [11/Nov/2012:14:29:37 +0330] "GET / HTTP/1.1" 200 6051
I had that error and it was caused by having inadvertently deleted the C:\Wamp\Apps folder. Tripped me up because I would have expected a 404 in that case, not a 403.
The simple and most effective sollution in my case and to what I suppose in most of the other cases is all about the access:-
Just follow the following simple step:-
Just Open your httpd.conf file, over there you will see the following
onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Just Change the Deny from All with Allow from All and save the changes and restart all your services in the Wamp server
(Change above with the following)
onlineoffline tag - don't remove
Order Deny,Allow
Allow from all
Allow from 127.0.0.1
No need to change your port or anything else.
Simple and 100% effective
Hope it help others aswell
Go to C:/Windows/System32/drivers/etc/hosts
add a new line with: 127.0.0.1 localhost

Apache2 Won't Reload: Looking for a File I Intentionally Deleted

Okay, so I'm following a guide to get set up with a Rails production server, and it says the following in the Apache2 setup:
We have to create a virtual host by creating a file in the "/etc/apache2/sites-available" directory (we will name it "site" - the file won't have any extension but it will be a text file).
$ sudo nano /etc/apache2/sites-available/site (this will create the file named "site" - can be any name - AND open it for editing)
Copy and paste this into that file (compare also with what the notes after installing mod_rails tells you):
VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot /home/user/public_html/site/public
/VirtualHost>
When I was first testing the waters with Apache I did as it said, making a fake scaffolded Rails app called "site". Now I want to use my real site, which we'll call "realthing." So I did
# sudo mv /etc/apache2/sites-available/site /etc/apache2/sites-available/realthing
And put my new settings into the renamed file. So far so good.
Then I went to restart Apache. Problems begin.
# sudo a2ensite realthing
Enabling site realthing.
To activate the new configuration, you need to run:
service apache2 reload
Okay, I can do that.
# sudo service apache2 reload
apache2: Syntax error on line 230 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/site: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
...fail!
Fail indeed. Nothing I can seem to do can get this thing to restart without flipping out about the missing "site" file. I check line 230 of /etch/apache2/apache2.conf for any specific references. Nope:
Include sites-enabled/
It's a generic reference to the folder containing "site". But no mention of "site".
So what's up? How do I get Apache to forget about the fake site "site" and move on to the real thing "realthing"? It's driving me insane that even a superuser reload is failing because Apache can't find a file that as far as I can tell it has no reason to expect to find.
Even a hard
sudo service apache2 stop
and
sudo service apache2 start
doesn't work. Again with the
* Starting web server apache2
apache2: Syntax error on line 230 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/site: No such file or directory
Action 'start' failed.
This is driving me bonkers. Any ideas?
The Apache error log may have more information.
You probably still have a symlink from sites-enabled/site to the now missing sites-available/site

Ruby error on non-ruby site

A friends of mine have a shared hosting with many sites hosted. There is ruby on rails, php, xslt/xml sites using mysql or postgress. Today one of the xslt sites displays this error:
Passenger error #2
An error occurred while trying to access '..../config/environment.rb': Cannot stat '..../config/environment.rb': Permission denied (13)
Apache doesn't have read permissions to that file. Please fix the relevant file permissions.
This is, as I Know, a ruby error (*.rb), but there is no ruby app here! And no any config/ catalogue.
The error log says:
(13)Permission denied: /home/..../.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
The .htaccess file in the htdocs directory is present and have 777 permission for now.
I haven't any idea what does it mean.
I experienced the same problem, Passenger error #2, suddenly and without correlation to any configuration change on my part. I did not add Ruby. I contacted host monster tech support, their level 2 support was baffled.
Confirming that Jaap Haagmans' solution; overriding PassengerEnabled with no from the .htaccess located in public_html works. Thank you kindly Mr.Haagmans.
I think the configuration of either your apache or nginx state that passenger is enabled. Check for a "passenger_enabled on" on nginx or "PassengerEnabled on" on apache in your webserver configuration file. Then disable it on top level or in the virtual host that runs a php website.
You could instead try to put "PassengerEnabled on" in a .htaccess file in the public_html folder (or equivalent, e.g. httpdocs). Also, make sure the .htaccess file is readable (e.g. 644 permissions in Linux), as that's what the error in your error log is saying.
Looks like there are some leaks in the web host's configuration. Passenger (which is like a mod_rails apache extension) is looking to load a particular Rails app's configuration, presumably not yours. If you're doing something important (like an e-commerce site) I'd run far away from the hosting company. Otherwise you'll have to get this resolved through them.

Resources