PDA

View Full Version : 403 Forbidden error


phillson
2-4-02, 03:30 AM
Hi! I am a newbie at php. Tried to run a very simple script and received the following message:

Forbidden
You don't have permission to access /testphp/index.php on this server.

Here is the simple script:

#!/usr/local/bin/php
<html>
<head>
<title>Comments</title>
</head>
<body>

<ul>

<?php
// Name: comments.php

print "<li>This text will be displayed.</li>";

print "<li>This text will also be displayed.</li>";
?>

</ul>
</body>
</html>

Here are the permissions on the file
-rwxr-xr-x 1 845 500 324 Feb 4 07:52 index.php

The FTP was done in Ascii mode.

Thanks for your help,
Pat

sophiespo
2-4-02, 07:59 AM
the permissions on the directory containing the script (in your case testphp/ ) need to be 755 as well.. have you checked that?

sophie

VBman
2-4-02, 09:31 AM
Is there a rule on when the directory permissions must be 755 as well? Should it be for all scripts or only certain ones? Perhaps only on scripts that write to a file in that directory, maybe. Does anyone know?:)

sophiespo
2-4-02, 11:16 AM
Nope, as far as I or anyone else can tell, any directory containing an executable script must also have executable permissions.. in other words if a cgi or php script is set to 755, the dir its in must be too.

sophie

phillson
2-4-02, 12:53 PM
Hi! here is the permissions on the directory

drwxr-xr-x 2 845 500 512 Feb 4 07:38 testphp

andrebajew
2-9-02, 07:24 PM
Howdy phillson,

with regard to your 403 on .php files, are you using a .htaccess file in this directory? If yes, if you rename the .htaccess to something else (.htaccess.0) does the 403 go away? If yes, then your .htaccess is doing something different (or more?) than you think. If you've already figured this out - nevermind.....

Regards,
Andre