Xampp Access Forbidden php
I'm a windows user. I've been using xampp for quite a while but suddenly none of my .php files are working now! I get this error 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 Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16
I can see the list of my .php files in localhost/Practice (Practice is the folder where I've saved my files) The file even opens whenever I click on it. But when I click on any 'submit' button inside any of my files, it gives this error. Please help! I updated xampp from 1.8.1 to 1.8.2 but still the same problem persists!
Try with this code below, add it in your virtual host config. Add this lines to httpd-vhosts.conf
file:
<Directory "c:/<path-to-projects>/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
I fixed the same issue by this way. Hope it helps.
Note:
after changes please test it in incognito because you redirected by cache
if used ubuntu operating system then check chmod of /Practice folder change read write permission
Open terminal press shortcut key
Ctrl+Alt+T
Goto
$ cd /opt/lampp/htdocs/
and change folder read write and execute permission by using chmod
command
e.g folder name is practice and path of folder /opt/lampp/htdocs/practice
Type command
$ sudo chmod 777 -R Practice
what is chmod
and 777
? visit this link
http://linuxcommand.org/lts0070.php
The way I resolved this was setup error logs correctly, first
<VirtualHost *:80>
DocumentRoot "D:/websites/test/"
ServerName test.dev
ErrorLog "D:/websites/test/logs/error.log"
CustomLog "D:/websites/test/logs/access.log" common
<Directory D:/websites/test/>
AllowOverride none
Require all granted
</Directory>
</VirtualHost>
After this error are being logged into "D:/websites/test/logs/" make sure to create logs folder yourself. The exact error that was recorded in error log was
AH01630: client denied by server configuration:
Which pointed me to correct solution using this link which said for the above error
Require all granted
is required. My sample sample code above fixes the problem by the way.
For XAMPP on Mac
sudo chmod -R 0777 /Applications/XAMPP/xamppfiles/htdocs/myprojectname
NOTE: remember to change 'myprojectname' to your actual project name. Also, make sure the project is on the root directory of htdocs or change the path accordingly.