Home >Backend Development >PHP Tutorial >How to solve the 403 Forbidden error in php server (apache)
Solution to 403 Forbidden error in apache server. Friends in need can refer to it.
Configured the virtual host, opened localhost and found an error:
HTTP error 403 - Forbidden, that is, 403 Forbidden: You don't have permission to access / on this server.
It may be permissions Problems caused by deficiencies.
Solution:
Open apache’s configuration file httpd.conf and check line by line.
Found:
Code example:
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Due After configuring php, here " Deny from all" means denying all connections.
Change this line to “Allow from all” to solve the problem.
The modified code is:
Code example:
Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all
Open in browser http://localhost, problem solved.
Summary:
In the apache server, when encountering 403 access forbidden, focus on whether there is a code like "Deny from all" in the httpd.conf configuration file of apache.
This may be automatically changed after modifying some configuration files and restarting apache.
Attached, another example of apache 403 error.
apache 403 error, the following information is displayed:
You do not have permission to view this webpage
You may not have permission to view this directory or webpage with the credentials you provided
If you are sure that you can view this directory or webpage, please try to use 192.168.1.5 Contact the website at the email address or phone number listed on the home page.
You can search with one click to find information on the Internet.
HTTP Error 403 - Forbidden
Internet Explorer
Remove the hook to display friendly information and display Forbidden You don't have permission to access on this server.
Checked the configuration file httpd.conf and found it Such a paragraph:
Code example:
Options FollowSymLinks
AllowOverride None
Order deny,allow
deny from all
Satisfy all
Then try to deny from Change the deny in all to allow, save and restart apache, and access to the test website is completely normal.
After APACHE was upgraded to version 2.2, it provides and supports many modules, and there are also many improvements in performance and security.
After configuring apache’s httpd.conf before, it can be used.
But now you must configure other aspects of this file, otherwise an http 403 permission problem error will occur.
Solution.
The following is a piece of original code from the httpd.conf file.
Change the red mark of the following code:
Code example:
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# [url]http://httpd.apache.org/docs/2.2/mod/core.html#options[/url]
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
.
The red part changes to Allow from all, that is, all access is allowed.
The above introduces the method to solve the 403 Forbidden error under PHP server (apache), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.