Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permission problem

Status
Not open for further replies.

raymondo

Technical User
May 3, 2002
86
0
0
AU
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
 
This is not an apache problem but I'm going to guess that it doesn't like the form action line.

 
Sorry, I'm really new at this and thought the message about no permission meant there was something amiss with my Apache set up. I 'll sart start with a very basic script and work up. Thanks for looking at it.

Raymondo
 
You might want to look into the php forum here at tek-tips. Another way to learn is by running and modifying other existing scripts. Here is a good source for free php scripts:
 
Hi

Probably in your php.ini the [tt]short_open_tag[/tt] is set to Off. You could set it to On, or modify the script and use long tag :
Code:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
As RhythmAce wrote, you will find a lot more answers in a forum434 ( PHP ).

Feherke.
 
Thanks RhythmAce and feherke. It turned out to be the form action. Short tags were off and after changing my script to long tags it worked without a hitch.

Raymondo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top