PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, February 11, 2022

[FIXED] Unable to access localhost - 403 forbidden

 February 11, 2022     apache, http-status-code-403, lamp, localhost, php     No comments   

Issue

I am able to access some areas of the localhost but cannot access others for example,

  • I can access localhost/index.php, localhost/somefolder/

  • but not localhost/somefolder/anotherfolder

I am also unable to include any file from inside anotherfolder in php because it says failed to open stream: No such file or directory

I have chmod -R 755 www but still unable to access sub directories

what may be the cause?


Solution

Check to see if you have SELinux running on that machine. Then do a ls -alZ on the directories you can view and the ones you can't. Chances are if you have SELinux enabled, the security group for the directory you can not view in is not set to the http security group. I believe it should be something to the effect of system_u:object_r:httpd_sys_content_t.

Check to see if SELinux is enabled on your system in /etc/selinux/config. If it is, go to the directory that you are having trouble with and type: chcon -Rv --type=httpd_sys_content_t <directory name>. That will add the httpd content security flag to that directory and everything under it, allowing apache to access it.



Answered By - Drahkar
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing