Jump to content

Permission problem for newbie


Raymondo

Recommended Posts

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

Link to comment
Share on other sites

[!--quoteo(post=328225:date=Dec 18 2005, 08:48 AM:name=Raymondo)--][div class=\'quotetop\']QUOTE(Raymondo @ Dec 18 2005, 08:48 AM) 328225[/snapback][/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

 

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.

 

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.