Forbidden You don't have permission to access

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
BigGreen
Forum Newbie
Posts: 2
Joined: Mon Oct 24, 2011 4:41 am

Forbidden You don't have permission to access

Post by BigGreen »

I have a php page (dataup.php) which the user can upload a CSV file. When the file is uploaded, a table is created which displays the content of the CSV file. If the file is OK, the contents of the file (listed in the table) can be submitted with form buton, this button calls the same page again to inset the data into a database. The script runs fine on my development pc (windows 7 and WAMP) but when loaded onto the web host (linux), on clicking the submit button I get

Forbidden
You don't have permission to access /member/dataup.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Folder is set to 755
I have tried setting the form action=

the page name.
the full url and page name
php_self
and left blank ie. action=' '

I am assuming this is a Linux/apache issue I am not addressing correctly rather than php

Thanks in anticipation
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Forbidden You don't have permission to access

Post by Eric! »

The apache module that is trying to write to your directory (user is called "www-data") doesn't have permission. Your development server is either less strict in enforcing file permissions (windows usually isn't strict) or www-data is in your group (775). Either you have to get your host to put www-data into your group or open up the directory's permissions (777).

FYI -- it looks like you also are missing your 404 error page.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Forbidden You don't have permission to access

Post by Celauran »

Eric! wrote:user is called "www-data"
Maybe. Could also be apache, or httpd, or a million other things. The correct solution is to chmod 777 the directory.
BigGreen
Forum Newbie
Posts: 2
Joined: Mon Oct 24, 2011 4:41 am

Re: Forbidden You don't have permission to access

Post by BigGreen »

Thanks for the replies, it is one of the million other things.
The chmod 755 or 777 is OK.
After far too many hours fiddling I have worked out that its the form which is too long.
The CSV file uploads to create a table for the person to check, its the submission of this form that causes the problem.
Its is not the content, but the size of the form when the csv file goes from 12kb to 13kb
Still not bottomed that one though.

Thanks
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Forbidden You don't have permission to access

Post by Eric! »

Check:
[text]#set max post size
php_value post_max_size 20M
#set max upload file size
php_value upload_max_filesize 20M
[/text]I think browsers can limit the post size too, but it is usually the server that causes the problem.
Post Reply