Jump to content


Photo

Permission problem for newbie


  • Please log in to reply
2 replies to this topic

#1 Raymondo

Raymondo
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 18 December 2005 - 12:48 AM

Hi,
I'm an absolute beginner trying to teach myself Apache, PHP and MySql. I have a PC running Windows XP and have set up a local server. The installation went reasonably well though it was rather daunting for a complete beginner. Anyway, I got things working and set off with PHP book in hand. The first few scripts worked without a problem but then came a script that was refused access with the following error message:

--------------
Forbidden

You don't have permission to access /phpStuff/< on this server.

Apache/2.0.55 (Win32) PHP/5.1.1 Server at localhost Port 80
--------------

phpStuff is the directory where I create my scripts and run them. It lives in a directory called

D:\MyServer\Apache Group\Apache2\htdocs

The script I'm running is:

<?php
if (!$_POST['submit']) {
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Enter a number: <input name="number" size="2">
<input type="submit" name="submit" value="Go">
</form>
<?php
}
else {
$number =$_POST['number'];
if ($number > 0) {
echo 'You entered a positive number';
}
elseif ($number < 0) {
echo 'You entered a negative number';
}
else {
echo 'You entered zero';
}
}
?>

When first loaded, the if part is executed no problem. When I submit the form, I get the above message.

Any help would be greatly appreciated.
Raymondo

#2 ProFire

ProFire
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 19 December 2005 - 05:33 AM

[!--quoteo(post=328225:date=Dec 18 2005, 08:48 AM:name=Raymondo)--][div class=\'quotetop\']QUOTE(Raymondo @ Dec 18 2005, 08:48 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hi,
I'm an absolute beginner trying to teach myself Apache, PHP and MySql. I have a PC running Windows XP and have set up a local server. The installation went reasonably well though it was rather daunting for a complete beginner. Anyway, I got things working and set off with PHP book in hand. The first few scripts worked without a problem but then came a script that was refused access with the following error message:

--------------
Forbidden

You don't have permission to access /phpStuff/< on this server.

Apache/2.0.55 (Win32) PHP/5.1.1 Server at localhost Port 80
--------------

phpStuff is the directory where I create my scripts and run them. It lives in a directory called

D:\MyServer\Apache Group\Apache2\htdocs

The script I'm running is:

<?php
if (!$_POST['submit']) {
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Enter a number: <input name="number" size="2">
<input type="submit" name="submit" value="Go">
</form>
<?php
}
else {
$number =$_POST['number'];
if ($number > 0) {
echo 'You entered a positive number';
}
elseif ($number < 0) {
echo 'You entered a negative number';
}
else {
echo 'You entered zero';
}
}
?>

When first loaded, the if part is executed no problem. When I submit the form, I get the above message.

Any help would be greatly appreciated.
Raymondo
[/quote]

I'm not very sure where your problem really lies but you can try some of these solutions out.

Instead of a POST method, try GET method.
Instead of "<?=$_SERVER['PHP_SELF']?>" , try to link to the page name instead of having php decide for you.


#3 Raymondo

Raymondo
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 December 2005 - 11:12 AM

Problem turned out to be so basic I'm embarrased. The php.ini file had short tags turned off so <? blah ?> wasn't recognised! Changed to long tags and bingo, all fixed.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users