I am working on a website where I have 2 php pages.

1st page: addfb.php
2nd page: fbadded.php

Now, "addfb.php" contains a form with a text field and a submitt button with form action method set to "fbadded.php"

Now whenever I click submit button on addfb.php, instead of going to fbadded.php, I am receiving one error which is like this:

Forbidden

You don't have permission to access /fbadded.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.16 Server at Port 80

I have several such forms on other pages but I don't get such sort of error on those pages.

Please help!

Dani AI

Generated

The symptoms (HTTP 403 on fbadded.php plus Apache failing to deliver its ErrorDocument) usually mean the webserver was blocked from reading that file or a server rule stopped access. was right to question the form action; was right to look at permissions — but a single chmod attempt often doesn't show the full picture. The fastest way to a root cause is to gather a few facts from the filesystem and the Apache error log, then run a small isolation test.

Useful commands to gather facts (run where the site files live):

ls -l fbadded.php
ls -ld .
ps aux | egrep '(httpd|apache|www-data|nobody)'

Look at the owner/group and mode. A typical safe setup is file mode 0644 and directory mode 0755, with the file owned either by the webserver user or readable by “others.” Avoid leaving files world-writable. If the webserver runs as a specific user, either chown the file to that user or ensure the read bit is set for others.

Check the Apache error log for the precise rejection reason:

tail -n 80 /var/log/apache2/error.log
# or
tail -n 80 /var/log/httpd/error_log

Do a quick isolation test by creating a tiny PHP file (for example a one-line script that echoes "OK") in the same directory and request it from the browser. If the test file is accessible but fbadded.php is still 403, that points at owner/group, extended attributes, .htaccess rules, or per-user PHP handlers (suPHP/suexec/mod_security) blocking that specific file. Temporarily move/rename any .htaccess to rule out rewrite/deny rules. On CentOS/RHEL check SELinux status with getenforce and file contexts with ls -Z.

Caution: never leave production files with 0777 permissions. The combination of exact error_log lines plus the ls -l output will almost always show whether this is a permission/ownership issue, an access rule in .htaccess/vhost, or a host-level security module.

Recommended Answers

All 5 Replies

Check if the path is not wrong in the action attribute of the form tag, it seems the document is not found: Additionally, a 404 Not Found error...

you need to change the access-rights(permissions) of the file
this is a unix command see this

chmod 664 fbadded.php

some ftp programs also have the posbilety to do this

the 404 is because apache tries to load a error page it can't find

Check if the path is not wrong in the action attribute of the form tag, it seems the document is not found: Additionally, a 404 Not Found error...

The path i gave is correct ... :(

you need to change the access-rights(permissions) of the file
this is a unix command see this

chmod 664 fbadded.php

some ftp programs also have the posbilety to do this

the 404 is because apache tries to load a error page it can't find

I even tried this.. but no success!!! :(

Just some questions:
what is the permission of that file?
also check the permission on the dir that its in?
is the dir above the webroot?
are you asked to provide a password?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.