Home > OS >  PHP File Forbidden Access on Localhost
PHP File Forbidden Access on Localhost

Time:09-16

I am trying to open a simple Hello World php file. But every time I try and run the file on my localhost server I get the following message. I have even tried editing the httpd-xampp.conf in the apache folder in xampp granting all but with no luck.

Error Message

Forbidden

You don't have permission to access this resource.`

Apache/2.4.48 (Win64) OpenSSL/1.1.1l PHP/8.0.10 Server at localhost Port 80

CodePudding user response:

It's difficult for us to diagnose your problem without inspecting your server configuration, but (assuming you have PHP installed okay) as a stop gap to get you up and running until you figure out this problem, you can use the built in PHP webserver. Open a command prompt or terminal in the directory where you want your document root to be and enter the following command:

php -S localhost:8000

Then navigate to http://localhost:8000 in your browser.

https://www.php.net/manual/en/features.commandline.webserver.php

CodePudding user response:

Open your apache configuration file and grant access for the directory that the php file is located in, example

<Directory "/folder/subfolder/noob/subfolder">
    Require all granted
</Directory>
  • Related