Website local error - php

I'm building a website. For some reason when I try to run it on the local host, I get this message:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Sat Nov 20 22:19:02 2010
Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1
What should I do to fix this so my website shows up on the local host. The website is coded in html/css/php. Thank you.

Look at the error logs.

I would agree with trying to read the apache log file for the specific error.
Sometimes, though, a 403 Forbidden error can be a simple permission error. Make sure the web directories are 755 and files are (atleast) 644 (but don't go chmod'ing everything to 777!)
For example,
chmod 755 /path/to/you/web/root
echo 'testing.. hello world!' > /path/to/you/web/root/test.php
chmod 644 /path/to/you/web/root/test.php
Hopefully that will get you going. If not, check your apache settings file (usually httpd.conf) and check out any mentioning of you web root. A 403 error can also be caused by apache trying to serve up a directory outside of it's WEBROOT.. meaning the webserver doesn't actually have access to the files.
Good luck.

Related

XAMPP Apache not working on Ubuntu 20.04.3 LTS

I have been searching for hours now and I cant find a solution. I have tried much to many things to even start listing the things. So please any assistance would be appreciated.
I have changed the htdocs folder location in httpd.conf because I have all my files sync to cloud storage. This works perfectly on my windows machine but on linux not so much. Every thing runs perfectly but when I try to access my htdocs folder (new location) I get a message:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.48 (Unix) OpenSSL/1.1.1k PHP/8.0.10 mod_perl/2.0.11 Perl/v5.32.1
But When I change the location back to the normal location it works perfectly.
I have already gave full access to the folder.
Think of a directory structure as a series of security doors:
/var
/www
/htdocs
If you give someone a key to htdocs (i.e. set the permissions to give a user access) then they can open that door… but only if they can get to it.
If you don't also give them keys to www and var then they can't get into htdocs.

Apache Windows 10 ,404 Not Found Error (Wamp)

I've installed php, mysql, apache with WAMP for windows 10. When I go to http://localhost there is not any problem, the appropriate page is shown. The server is up and running, but when I try to open http://localhost/test.php it gives me 404 not found error. By the way I've put the index.html and test.php into wamp64/bin/apache/apache2.4.46/htdocs. The server can access neither index.html in that directory nor test.php. Your help is welcome.
Like #Selim Achour said I looked to the error logs and I found that apache server wasp/ searching the test.php in a folder called wamp/www/test.php. When I move the test.php from htdocs/test.php to www/test.php it works perfectly. I was following instructions from a book that I'd been reading. In that book's instructions, it is clearly stated that you should move test.php into htdocs. That was what got me confused. Thank you all for your effort.
The error: Sat Sep 26 13:14:03.134587 2020] [php7:error] [pid 8220:tid 1204] [client ::1:6466] script 'C:/wamp64/www/test.php' not found or unable to stat
WAMPServer's DocumentRoot folder is C:\wamp64\www BUT You should NEVER place your scripts into that folder!!!
Make a subfolder and use that i.e. C:\wamp\www\test1 put your test.php in there and run using locahost/test1/test.php
Better still create a Virtual Host for all your test areas and development site folders. See THE NEED for VIRTUAL HOSTS and then WAMPServer 3 Create a Virtual Host, the easy way

Access forbidden! While running Laravell Project

I am facing below error while running laravell project first time on my local xamp server
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403: localhost Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/7.1.4
This is nothing todo with Laravel, its the folder permissions, you need to make the root folder readable and make sure .htaccess is readable. As its local I would suggest setting the root folder to readable by everyone and try again.
Also it could be because you are not pointing your server to the public folder of your Laravel application

Forbidden Error in Apache after extracting files

My dedicated server has Debian wheezy installed along with Apache2 php and mysql. ISPConfig3 is installed as the control panel.
After creating a site under ISPConfig and a shell user account with it I uploaded the tar file into the web directory and extracted the files.
The default ispconfig index.html file would display how ever after the extraction the index.php is not getting picked up and after deleting the default index.php i get the error message
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
I tried going directly to www.domain.com/index.php and that doesnt work too.
Do I have to modify anything in apache? Any help would be appreciated.
That error is telling you the server can't read the file (or files) specified in your DirectoryIndex directive, and is trying to display a 403 (security) error document instead, which is doesn't have permission to read either.
You need to check what user your httpd daemon is running as, and make sure that user had at least read permissions to all the files in your DocumentRoot. The best way to do this is to ensure that user is the owner of the files.
On a Redhat/CentOS system, httpd runs as the user "apache"
chown -R apache:apache /var/www/html

I'm not able to access localhost on my linux m/c running Apache/2.2.14 (Ubuntu)

Accessing http://localhost or http://127.0.0.1 gives me a 404 URL not found error. This is in spite of me having apache 2.2.14 running on my PC (the apache process is started). Any help in this regard will be appreciated. Thank you!
If you're getting a 404 not found it means that the server is running but can't find the document you're looking for.
If you look in your Apache config file you'll find a setting for "document root". Place a file called "index.html" in that directory.
This usually defaults to /var/www on Ubuntu.
For more info you can check the Ubuntu community site

Categories